[Commits] (morgen) Added a webdav account to the Account Preferences dialog. Only the

commits at osafoundation.org commits at osafoundation.org
Fri Aug 27 14:05:53 PDT 2004


Commit by: morgen
Modified files:
chandler/application/dialogs/AccountPreferences.py 1.3 1.4
chandler/application/dialogs/AccountPreferences.wdr 1.2 1.3
chandler/application/dialogs/AccountPreferences_wdr.xrc 1.2 1.3
chandler/application/dialogs/PublishCollection.py 1.7 1.8
chandler/parcels/osaf/framework/sharing/Sharing.py 1.11 1.12
chandler/parcels/osaf/framework/sharing/parcel.xml 1.2 1.3
chandler/parcels/osaf/framework/webdav/parcel.xml 1.3 1.4
chandler/parcels/osaf/views/main/Main.py 1.44 1.45

Log message:
Added a webdav account to the Account Preferences dialog.  Only the
server and path fields are actually honored so far.  Once those two
values are set, when you go to publish a collection, the url for that
collection will be built up as:  http://server/path/uuid
If you haven't set up your webdav account, the collection sharing
menu item is disabled.  Also, the invitation acceptance dialog now
tells you who the invitation is from and what the collection's name is
(instead of the url).


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/AccountPreferences.py.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/AccountPreferences.wdr.diff?r1=text&tr1=1.2&r2=text&tr2=1.3
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/AccountPreferences_wdr.xrc.diff?r1=text&tr1=1.2&r2=text&tr2=1.3
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/PublishCollection.py.diff?r1=text&tr1=1.7&r2=text&tr2=1.8
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/Sharing.py.diff?r1=text&tr1=1.11&r2=text&tr2=1.12
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/parcel.xml.diff?r1=text&tr1=1.2&r2=text&tr2=1.3
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/webdav/parcel.xml.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/Main.py.diff?r1=text&tr1=1.44&r2=text&tr2=1.45

Index: chandler/application/dialogs/AccountPreferences.py
diff -u chandler/application/dialogs/AccountPreferences.py:1.3 chandler/application/dialogs/AccountPreferences.py:1.4
--- chandler/application/dialogs/AccountPreferences.py:1.3	Thu Aug 26 19:36:54 2004
+++ chandler/application/dialogs/AccountPreferences.py	Fri Aug 27 14:05:49 2004
@@ -8,6 +8,8 @@
 
 # Used to lookup the mail model parcel:
 MAIL_MODEL = "http://osafoundation.org/parcels/osaf/contentmodel/mail"
+# Used to lookup the webdav parcel:
+WEBDAV_MODEL = "http://osafoundation.org/parcels/osaf/framework/webdav"
 
 # Used to map form fields to item attributes:
 PANELS = {
@@ -81,6 +83,39 @@
         },
         "id" : "SMTPPane",
     },
+    "WebDAV" : {
+        "fields" : {
+            "WEBDAV_DESCRIPTION" : {
+                "attr" : "displayName",
+                "type" : "string",
+            },
+            "WEBDAV_SERVER" : {
+                "attr" : "host",
+                "type" : "string",
+            },
+            "WEBDAV_PATH" : {
+                "attr" : "path",
+                "type" : "string",
+            },
+            "WEBDAV_USERNAME" : {
+                "attr" : "username",
+                "type" : "string",
+            },
+            "WEBDAV_PASSWORD" : {
+                "attr" : "password",
+                "type" : "string",
+            },
+            "WEBDAV_PORT" : {
+                "attr" : "port",
+                "type" : "integer",
+            },
+            "WEBDAV_USE_SSL" : {
+                "attr" : "useSSL",
+                "type" : "boolean",
+            },
+        },
+        "id" : "WebDAVPane",
+    },
 }
 
 class AccountPreferencesDialog(wx.Dialog):
@@ -112,14 +147,15 @@
         repo.commit()
 
         accountKind = pm.lookup(MAIL_MODEL, "AccountBase")
+        webDavAccountKind = pm.lookup(WEBDAV_MODEL, "WebDAVAccount")
         i = 0
-        for item in KindQuery().run([accountKind]):
+        for item in KindQuery().run([accountKind, webDavAccountKind]):
             values = { }
             for (field, desc) in \
              PANELS[item.accountType]['fields'].iteritems():
                 values[field] = item.getAttributeValue(desc['attr'])
             self.data.append( { "item" : item, "values" : values } )
-            self.accountsList.Append(item.itsName)
+            self.accountsList.Append(item.displayName)
             i += 1
 
         if i > 0:

Index: chandler/application/dialogs/AccountPreferences_wdr.xrc
diff -u chandler/application/dialogs/AccountPreferences_wdr.xrc:1.2 chandler/application/dialogs/AccountPreferences_wdr.xrc:1.3
--- chandler/application/dialogs/AccountPreferences_wdr.xrc:1.2	Mon Aug 23 16:06:14 2004
+++ chandler/application/dialogs/AccountPreferences_wdr.xrc	Fri Aug 27 14:05:49 2004
@@ -408,7 +408,7 @@
                     <border>5</border>
                     <object class="wxStaticText" name="ID_TEXT">
                         <size>200,-1</size>
-                        <label>WebDAV</label>
+                        <label>WebDAV (Collection publishing)</label>
                     </object>
                 </object>
                 <object class="sizeritem">

Index: chandler/parcels/osaf/framework/sharing/Sharing.py
diff -u chandler/parcels/osaf/framework/sharing/Sharing.py:1.11 chandler/parcels/osaf/framework/sharing/Sharing.py:1.12
--- chandler/parcels/osaf/framework/sharing/Sharing.py:1.11	Fri Aug 27 12:22:42 2004
+++ chandler/parcels/osaf/framework/sharing/Sharing.py	Fri Aug 27 14:05:49 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.11 $"
-__date__ = "$Date: 2004/08/27 19:22:42 $"
+__version__ = "$Revision: 1.12 $"
+__date__ = "$Date: 2004/08/27 21:05:49 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -28,9 +28,9 @@
 
     def _sharingUpdateCallback(self, notification):
         # When we receive the event, display a dialog
-        url = notification.data['share']
-        collectionName = notification.data['name']
-        fromAddress = notification.data['from']
+        url = notification.data['share'].strip()
+        collectionName = notification.data['name'].strip()
+        fromAddress = notification.data['from'].strip()
         print "Received invite from %s; collection '%s' at %s" % (fromAddress,
          collectionName, url)
         collection = collectionFromSharedUrl(url)
@@ -42,7 +42,7 @@
         else:
             if application.dialogs.Util.promptYesNo( \
              Globals.wxApplication.mainFrame, "Sharing Invitation",
-             "Subscribe to collection:\n%s ?" % url):
+             "%s\nhas invited you to subscribe to '%s'\nWould you like to accept the invitation?" % (fromAddress, collectionName) ):
                 subscribeToWebDavCollection(url)
 
     def _errorCallback(self, notification):
@@ -105,6 +105,13 @@
                 return item
     return None
 
+def getWebDavPath():
+    acct = Globals.parcelManager.lookup(SHARING, 'WebDAVAccount')
+    if acct.host:
+        return "http://%s/%s" % (acct.host, acct.path)
+    else:
+        return None
+
 # Non-blocking methods that the mail thread can call to post events to the
 # main thread:
 

Index: chandler/parcels/osaf/framework/sharing/parcel.xml
diff -u chandler/parcels/osaf/framework/sharing/parcel.xml:1.2 chandler/parcels/osaf/framework/sharing/parcel.xml:1.3
--- chandler/parcels/osaf/framework/sharing/parcel.xml:1.2	Wed Aug 25 10:31:42 2004
+++ chandler/parcels/osaf/framework/sharing/parcel.xml	Fri Aug 27 14:05:49 2004
@@ -1,13 +1,14 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.2 $ -->
-<!-- $Date: 2004/08/25 17:31:42 $ -->
+<!-- $Revision: 1.3 $ -->
+<!-- $Date: 2004/08/27 21:05:49 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
 <Parcel itsName="sharing"
     xmlns="http://osafoundation.org/parcels/core"
     xmlns:notif="http://osafoundation.org/parcels/osaf/framework/notifications/schema"
+    xmlns:webdav="http://osafoundation.org/parcels/osaf/framework/webdav"
     itemClass="osaf.framework.sharing.Sharing.Parcel"
     >
 
@@ -26,4 +27,8 @@
         <description value="This event is posted from the mail system if an invite fails to be sent." />
     </notif:Event>
 
+    <webdav:WebDAVAccount itsName="WebDAVAccount">
+        <displayName value="WebDAV"/>
+    </webdav:WebDAVAccount>
+
 </Parcel>

Index: chandler/application/dialogs/PublishCollection.py
diff -u chandler/application/dialogs/PublishCollection.py:1.7 chandler/application/dialogs/PublishCollection.py:1.8
--- chandler/application/dialogs/PublishCollection.py:1.7	Fri Aug 27 12:23:04 2004
+++ chandler/application/dialogs/PublishCollection.py	Fri Aug 27 14:05:49 2004
@@ -9,6 +9,7 @@
 import application.dialogs.Util
 import osaf.framework.sharing.Sharing
 
+#@@@ This will go away:
 DEFAULT_URL = "http://code-bear.com/dav"
 
 class PublishCollectionDialog(wx.Dialog):
@@ -28,7 +29,13 @@
         if osaf.framework.sharing.Sharing.isShared(collection):
             self.urlText.SetValue("%s" % collection.sharedURL)
         else:
-            self.urlText.SetValue("%s/%s" % (DEFAULT_URL, collection.itsUUID))
+            path = osaf.framework.sharing.Sharing.getWebDavPath()
+            if path:
+                self.urlText.SetValue("%s/%s" % (path, collection.itsUUID))
+            else:
+                #@@@ This will go away:
+                self.urlText.SetValue("%s/%s" % (DEFAULT_URL, 
+                 collection.itsUUID))
 
         self.inviteesText = wx.xrc.XRCCTRL(self, "ID_INVITEES")
 

Index: chandler/parcels/osaf/framework/webdav/parcel.xml
diff -u chandler/parcels/osaf/framework/webdav/parcel.xml:1.3 chandler/parcels/osaf/framework/webdav/parcel.xml:1.4
--- chandler/parcels/osaf/framework/webdav/parcel.xml:1.3	Thu Aug 12 11:00:32 2004
+++ chandler/parcels/osaf/framework/webdav/parcel.xml	Fri Aug 27 14:05:50 2004
@@ -14,4 +14,59 @@
     </Attribute>
   </Kind>
 
+
+    <Kind itsName="WebDAVAccount">
+        <superKinds ref="Item" />
+        <displayName value="WebDAV Account" />
+        <description value="A WebDAV 'Account'" />
+        <issues value="Long term we're probably not going to treat WebDAV as an account, but rather how a web browser maintains URL-to-ACL mappings." />
+
+        <Attribute itsName="username">
+            <displayName value="Username" />
+            <type ref="String" />
+            <initialValue type="String" />
+        </Attribute>
+
+        <Attribute itsName="password">
+            <displayName value="Password" />
+            <issues value="This should not be a simple string. We need some solution for encrypting it." />
+            <type ref="String" />
+            <initialValue type="String" />
+        </Attribute>
+
+        <Attribute itsName="host">
+            <displayName value="Host" />
+            <description value="The hostname of the account" />
+            <type ref="String" />
+            <initialValue type="String" />
+        </Attribute>
+
+        <Attribute itsName="path">
+            <displayName value="Path" />
+            <description value="Base path on the host to use for publishing" />
+            <type ref="String" />
+            <initialValue type="String" />
+        </Attribute>
+
+        <Attribute itsName="port">
+            <displayName value="Port" />
+            <description value="The non-SSL port number to use" />
+            <type ref="Integer" />
+            <initialValue type="Integer" value="80" />
+        </Attribute>
+
+        <Attribute itsName="useSSL">
+            <displayName value="Use secure connection (SSL/TLS)" />
+            <description value="Whether or not to use SSL/TLS" />
+            <type ref="Boolean" />
+            <initialValue type="Boolean" value="False" />
+        </Attribute>
+
+        <Attribute itsName="accountType">
+            <displayName value="Account Type" />
+            <initialValue type="String" value="WebDAV" />
+        </Attribute>
+
+    </Kind>
+
 </Parcel>

Index: chandler/parcels/osaf/views/main/Main.py
diff -u chandler/parcels/osaf/views/main/Main.py:1.44 chandler/parcels/osaf/views/main/Main.py:1.45
--- chandler/parcels/osaf/views/main/Main.py:1.44	Wed Aug 25 14:54:24 2004
+++ chandler/parcels/osaf/views/main/Main.py	Fri Aug 27 14:05:50 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.44 $"
-__date__ = "$Date: 2004/08/25 21:54:24 $"
+__version__ = "$Revision: 1.45 $"
+__date__ = "$Date: 2004/08/27 21:05:50 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -113,8 +113,8 @@
 
 
     def onGetNewMailEvent (self, notification):
-        accountList = [Globals.repository.findPath('//parcels/osaf/mail/IMAPAccountOne')]
-        account = accountList[0]
+        account = \
+         Globals.repository.findPath('//parcels/osaf/mail/IMAPAccountOne')
         IMAPDownloader (account).getMail()
 
     def onNewEvent (self, notification):
@@ -224,6 +224,11 @@
         """
         Update the menu to reflect the selected collection name
         """
+        # Only enable it user has set their webdav account up
+        if osaf.framework.sharing.Sharing.getWebDavPath() == None:
+            notification.data ['Enable'] = False
+            return
+
         collection = self.getSidebarSelectedCollection ()
         notification.data ['Enable'] = collection is not None
         if collection:



More information about the Commits mailing list