summaryrefslogtreecommitdiff
path: root/wizards/com/sun
diff options
context:
space:
mode:
authorJavier Fernandez <jfernandez@igalia.com>2013-05-03 14:58:19 +0000
committerJavier Fernandez <jfernandez@igalia.com>2013-05-08 09:36:40 +0000
commitd3cc742d28b81f939b8b640c73e700d7d8cf1987 (patch)
tree4f2bfc8043dcd3cc6e335de5ea264de42a848c5e /wizards/com/sun
parent4ed7466f748579d92a26b99ae8e9be21a7da9573 (diff)
PyWebWizard: Fixing bugs and implementation of mising features.
Implemented the FTP Publishing capabilities. Change-Id: I3dbd2639947a219a494ae219153fcc7f3e30785e
Diffstat (limited to 'wizards/com/sun')
-rw-r--r--wizards/com/sun/star/wizards/web/FTPDialog.py112
-rw-r--r--wizards/com/sun/star/wizards/web/FTPDialogResources.py70
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_Events.py9
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_Startup.py2
4 files changed, 67 insertions, 126 deletions
diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.py b/wizards/com/sun/star/wizards/web/FTPDialog.py
index 6cd34aea0dfb..c3921eb6eca6 100644
--- a/wizards/com/sun/star/wizards/web/FTPDialog.py
+++ b/wizards/com/sun/star/wizards/web/FTPDialog.py
@@ -31,16 +31,16 @@ from ..common.UCB import UCB
from .data.CGPublish import CGPublish
from .data.CGSettings import CGSettings
-#from com.sun.star.ucb import AuthenticationRequest
-#from com.sun.star.ucb import InteractiveAugmentedIOException
-#from com.sun.star.ucb import InteractiveNetworkConnectException
-#from com.sun.star.ucb import InteractiveNetworkResolveNameException
-#from com.sun.star.ucb import OpenCommandArgument2
-#from com.sun.star.ucb import OpenMode
+from com.sun.star.ucb import AuthenticationRequest
+from com.sun.star.ucb import InteractiveAugmentedIOException
+from com.sun.star.ucb import InteractiveNetworkConnectException
+from com.sun.star.ucb import InteractiveNetworkResolveNameException
+from com.sun.star.ucb import OpenCommandArgument2
+from com.sun.star.ucb.OpenMode import FOLDERS
-PushButtonType_OK_value = uno.getConstantByName( "com.sun.star.awt.PushButtonType.OK" )
-PushButtonType_CANCEL_value = uno.getConstantByName( "com.sun.star.awt.PushButtonType.CANCEL" )
-PushButtonType_HELP_value = uno.getConstantByName( "com.sun.star.awt.PushButtonType.HELP" )
+#PushButtonType_OK_value = uno.getConstantByName( "com.sun.star.awt.PushButtonType.OK" )
+#PushButtonType_CANCEL_value = uno.getConstantByName( "com.sun.star.awt.PushButtonType.CANCEL" )
+#PushButtonType_HELP_value = uno.getConstantByName( "com.sun.star.awt.PushButtonType.HELP" )
# This is the FTP Dialog. <br/>
@@ -90,44 +90,6 @@ class FTPDialog(UnoDialog2, UIConsts):
ICON_UNKNOWN = "ftpunknown.gif"
# The icon url for an icon representing the "connecting" state.
ICON_CONNECTING = "ftpconnecting.gif" # GUI Components as Class members.
- # Fixed Line
- ln1 = None
- lblFTPAddress = None
- txtHost = None
- lblUsername = None
- txtUsername = None
- lblPassword = None
- txtPassword = None
- # Fixed Line
- ln2 = None
- btnTestConnection = None
- imgStatus = None
- lblStatus = None
- # Fixed Line
- ln3 = None
- txtDir = None
- btnDir = None
- btnOK = None
- btnCancel = None
- btnHelp = None
- # Font Descriptors as Class members.
-
- # Resources Object
- resources = None
- dataAware = []
- username = ""
- password = ""
-
- #The ftp host name
- host = ""
- #The ftp directory.
- folder = ""
- #the ftp publish object which contains the
- #data for this dialog.
- publish = None
- ucb = None
- #used for the status images url.
- imagesDirectory = ""
# constructor.
# constructs the UI.
@@ -136,13 +98,18 @@ class FTPDialog(UnoDialog2, UIConsts):
# for this dialog
# @throws Exception
def __init__(self, xmsf, p):
+
super(FTPDialog, self).__init__(xmsf)
self.publish = p
- #templateDir = p.root.soTemplateDir
- templateDir = ""
+ templateDir = p.root.soTemplateDir
self.imagesDirectory = FileAccess.connectURLs(templateDir, "../wizard/bitmap/")
+ self.dataAware = []
+ self.host = ""
+ self.username = ""
+ self.password = ""
+
# Load Resources
self.resources = FTPDialogResources(xmsf)
self.ucb = UCB(xmsf)
@@ -181,10 +148,10 @@ class FTPDialog(UnoDialog2, UIConsts):
PROPNAMES_BUTTON = (PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH)
PROPNAMES_BUTTON2 = (PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH)
- ln1 = self.insertFixedLine("ln1",
+ self.ln1 = self.insertFixedLine("ln1",
PROPNAMES_LABEL,
(8, self.resources.resln1_value, "ln1", 6, 6, 0, 210))
- lblFTPAddress = self.insertLabel("lblFTPAddress",
+ self.lblFTPAddress = self.insertLabel("lblFTPAddress",
PROPNAMES_LABEL,
(8, self.resources.reslblFTPAddress_value, "lblFTPAddress", 12, 20, 1, 95))
self.txtHost = self.insertTextField("txtHost", "disconnect",
@@ -258,7 +225,7 @@ class FTPDialog(UnoDialog2, UIConsts):
result = self.executeDialogFromParent(parent)
# change the CGPublish properties
if (result == 1):
- self.publish.cp_URL = "ftp://" + self.host() + self.getDir()
+ self.publish.cp_URL = "ftp://" + self.getHost() + self.getDir()
self.publish.cp_Username = self.username
self.publish.password = self.password
@@ -278,12 +245,12 @@ class FTPDialog(UnoDialog2, UIConsts):
def extractHost(self, ftpUrl):
if (ftpUrl is None or len(ftpUrl) < 6):
return ""
- url = ftpUrl.substring(6)
- i = url.indexOf("/")
+ url = ftpUrl[6:]
+ i = url.find("/")
if (i == -1):
return url
else:
- return url.substring(0, i)
+ return url[:i]
# used to get data from the CGPublish object.
# @param ftpUrl
@@ -291,12 +258,12 @@ class FTPDialog(UnoDialog2, UIConsts):
def extractDir(self, ftpUrl):
if (ftpUrl is None or len(ftpUrl) < 6):
return "/"
- url = ftpUrl.substring(6)
- i = url.indexOf("/")
+ url = ftpUrl[6:]
+ i = url.find("/")
if (i == -1):
return "/"
else:
- return url.substring(i)
+ return url[i:]
# enables/disables the "test" button
# according to the status of the hostname, username, password text fields.
@@ -311,21 +278,21 @@ class FTPDialog(UnoDialog2, UIConsts):
# @return the ftp url with username and password,
# but without the directory portion.
- def getAcountUrl(self):
- return "ftp://" + self.username + ":" + self.password + "@" + self.host()
+ def getAccountUrl(self):
+ return "ftp://" + self.username + ":" + self.password + "@" + self.getHost()
# return the host name without the "ftp://"
# @return
- def host(self):
- return self.host(self.host)
+ def getHost(self):
+ return self.getHost1(self.host)
@classmethod
- def host1(self, s):
- return s.substring(6) if s.startswith("ftp://") else s
+ def getHost1(self, s):
+ return s[6:] if s.startswith("ftp://") else s
# @return the full ftp url including username, password and directory portion.
def getFullUrl(self):
- return self.getAcountUrl() + self.folder
+ return self.getAccountUrl() + self.folder
# First I try to connect to the full url, including directory.
# If an InteractiveAugmentedIOException accures, I try again,
@@ -340,7 +307,7 @@ class FTPDialog(UnoDialog2, UIConsts):
success = True
except InteractiveAugmentedIOException as iaioex:
try:
- self.connect1(self.getAcountUrl())
+ self.connect1(self.getAccountUrl())
self.setDir("/")
success = True
except Exception:
@@ -372,20 +339,20 @@ class FTPDialog(UnoDialog2, UIConsts):
# @param acountUrl
# @throws Exception
def connect1(self, acountUrl):
- content = self.ucb.getContent(self.acountUrl)
+ content = self.ucb.getContent(self.getAccountUrl())
# list files in the content.
- l = self.ucb.listFiles(self.acountUrl, None)
+ l = self.ucb.listFiles(self.getAccountUrl(), None)
# open the content
aArg = OpenCommandArgument2()
- aArg.Mode = OpenMode.FOLDERS # FOLDER, DOCUMENTS -> simple filter
+ aArg.Mode = FOLDERS # FOLDER, DOCUMENTS -> simple filter
aArg.Priority = 32768 # Ignored by most implementations
self.ucb.executeCommand(content, "open", aArg)
# get the title property of the content.
- obj = self.ucb.getContentProperty(content, PropertyNames.PROPERTY_TITLE, str())
+ obj = self.ucb.getContentProperty(content, "Title", str)
# changes the ftp subdirectory, in both
# the UI and the data.
@@ -459,7 +426,7 @@ class FTPDialog(UnoDialog2, UIConsts):
# if the user chose a local directory,
# sI do not accept it.
if (newUrl.startswith("ftp://")):
- self.setDir(extractDir(newUrl))
+ self.setDir(self.extractDir(newUrl))
else:
AbstractErrorHandler.showMessage(self.xMSF, self.xUnoDialog.getPeer(), self.resources.resIllegalFolder, ErrorHandler.ERROR_PROCESS_FATAL)
@@ -468,5 +435,4 @@ class FTPDialog(UnoDialog2, UIConsts):
# @return the full ftp url with username password and everything one needs.
@classmethod
def getFullURL1(self, p):
- #return "ftp://" + p.Username + ":" + p.password + "@" + self.host(p.URL)
- return "ftp://" + p.cp_Username + ":" + "" + "@" + self.host1(p.cp_URL)
+ return "ftp://" + p.cp_Username + ":" + p.password + "@" + self.getHost1(p.cp_URL)
diff --git a/wizards/com/sun/star/wizards/web/FTPDialogResources.py b/wizards/com/sun/star/wizards/web/FTPDialogResources.py
index 1190fe0aacb6..8785d083bc93 100644
--- a/wizards/com/sun/star/wizards/web/FTPDialogResources.py
+++ b/wizards/com/sun/star/wizards/web/FTPDialogResources.py
@@ -23,57 +23,33 @@ class FTPDialogResources(Resource):
MODULE_NAME = "dbw"
RID_FTPDIALOG_START = 4200
RID_COMMON_START = 500
- resFTPDialog_title = ""
- reslblUsername_value = ""
- reslblPassword_value = ""
- resbtnConnect_value = ""
- resbtnOK_value = ""
- resbtnHelp_value = ""
- resbtnCancel_value = ""
- resln1_value = ""
- reslblFTPAddress_value = ""
- resln2_value = ""
- resln3_value = ""
- esln3_value = ""
- restxtDir_value = ""
- resbtnDir_value = ""
- resFTPDisconnected = ""
- resFTPConnected = ""
- resFTPUserPwdWrong = ""
- resFTPServerNotFound = ""
- resFTPRights = ""
- resFTPHostUnreachable = ""
- resFTPUnknownError = ""
- resFTPDirectory = ""
- resIllegalFolder = ""
- resConnecting = ""
def __init__(self, xmsf):
super(FTPDialogResources, self).__init__(xmsf, self.MODULE_NAME)
# Delete the String, uncomment the getResText method
- resFTPDialog_title = self.getResText(self.RID_FTPDIALOG_START + 0)
- reslblUsername_value = self.getResText(self.RID_FTPDIALOG_START + 1)
- reslblPassword_value = self.getResText(self.RID_FTPDIALOG_START + 2)
- resbtnConnect_value = self.getResText(self.RID_FTPDIALOG_START + 3)
- resln1_value = self.getResText(self.RID_FTPDIALOG_START + 4)
- reslblFTPAddress_value = self.getResText(self.RID_FTPDIALOG_START + 5)
- resln2_value = self.getResText(self.RID_FTPDIALOG_START + 6)
- resln3_value = self.getResText(self.RID_FTPDIALOG_START + 7)
- resbtnDir_value = self.getResText(self.RID_FTPDIALOG_START + 8)
- resFTPDisconnected = self.getResText(self.RID_FTPDIALOG_START + 9)
- resFTPConnected = self.getResText(self.RID_FTPDIALOG_START + 10)
- resFTPUserPwdWrong = self.getResText(self.RID_FTPDIALOG_START + 11)
- resFTPServerNotFound = self.getResText(self.RID_FTPDIALOG_START + 12)
- resFTPRights = self.getResText(self.RID_FTPDIALOG_START + 13)
- resFTPHostUnreachable = self.getResText(self.RID_FTPDIALOG_START + 14)
- resFTPUnknownError = self.getResText(self.RID_FTPDIALOG_START + 15)
- resFTPDirectory = self.getResText(self.RID_FTPDIALOG_START + 16)
- resIllegalFolder = self.getResText(self.RID_FTPDIALOG_START + 17)
- resConnecting = self.getResText(self.RID_FTPDIALOG_START + 18)
+ self.resFTPDialog_title = self.getResText(self.RID_FTPDIALOG_START + 0)
+ self.reslblUsername_value = self.getResText(self.RID_FTPDIALOG_START + 1)
+ self.reslblPassword_value = self.getResText(self.RID_FTPDIALOG_START + 2)
+ self.resbtnConnect_value = self.getResText(self.RID_FTPDIALOG_START + 3)
+ self.resln1_value = self.getResText(self.RID_FTPDIALOG_START + 4)
+ self.reslblFTPAddress_value = self.getResText(self.RID_FTPDIALOG_START + 5)
+ self.resln2_value = self.getResText(self.RID_FTPDIALOG_START + 6)
+ self.resln3_value = self.getResText(self.RID_FTPDIALOG_START + 7)
+ self.resbtnDir_value = self.getResText(self.RID_FTPDIALOG_START + 8)
+ self.resFTPDisconnected = self.getResText(self.RID_FTPDIALOG_START + 9)
+ self.resFTPConnected = self.getResText(self.RID_FTPDIALOG_START + 10)
+ self.resFTPUserPwdWrong = self.getResText(self.RID_FTPDIALOG_START + 11)
+ self.resFTPServerNotFound = self.getResText(self.RID_FTPDIALOG_START + 12)
+ self.resFTPRights = self.getResText(self.RID_FTPDIALOG_START + 13)
+ self.resFTPHostUnreachable = self.getResText(self.RID_FTPDIALOG_START + 14)
+ self.resFTPUnknownError = self.getResText(self.RID_FTPDIALOG_START + 15)
+ self.resFTPDirectory = self.getResText(self.RID_FTPDIALOG_START + 16)
+ self.resIllegalFolder = self.getResText(self.RID_FTPDIALOG_START + 17)
+ self.resConnecting = self.getResText(self.RID_FTPDIALOG_START + 18)
- resbtnCancel_value = self.getResText(self.RID_COMMON_START + 11)
- resbtnOK_value = self.getResText(self.RID_COMMON_START + 18)
- resbtnHelp_value = self.getResText(self.RID_COMMON_START + 15)
+ self.resbtnCancel_value = self.getResText(self.RID_COMMON_START + 11)
+ self.resbtnOK_value = self.getResText(self.RID_COMMON_START + 18)
+ self.resbtnHelp_value = self.getResText(self.RID_COMMON_START + 15)
- restxtDir_value = "/"
+ self.restxtDir_value = "/"
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index b72032fb301f..e6825ac1db83 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -783,9 +783,7 @@ class WWD_Events(WWD_Startup):
'''
p = self.getPublisher(FTP_PUBLISHER)
# if ftp is checked, and no proxies are set, and password is empty...
- password = getattr(p, "password", "")
- print ("FTP checked: ", p.cp_Publish)
- if p.cp_Publish and not proxies and (password is None or password == ""):
+ if p.cp_Publish and not self.proxies and (p.password is None or p.password == ""):
if self.showFTPDialog(p):
self.updatePublishUI(2)
#now continue...
@@ -819,7 +817,7 @@ class WWD_Events(WWD_Startup):
and now ftp...
'''
p = self.getPublisher(FTP_PUBLISHER)
- p.url = FTPDialog.getFullURL1(p);
+ p.url = FTPDialog.getFullURL1(p)
''' first we check the publishing targets. If they exist we warn and
ask what to do. a False here means the user said "cancel"
@@ -832,8 +830,9 @@ class WWD_Events(WWD_Startup):
I return the value of the ftp publisher cp_Publish
property to its original value...
'''
+ if self.proxies:
+ p.cp_Publish = self.ftp
- p.cp_Publish = self.ftp
#if the "save settings" checkbox is on...
if self.isSaveSession():
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index a31806e6e523..82959d1cfcda 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py
@@ -297,7 +297,7 @@ class WWD_Startup(WWD_General):
#WWD_General.settings.cp_Styles.sort(None)
self.prepareSessionLists()
if self.proxies:
- self.__ftp = self.getPublisher(FTP_PUBLISHER).cp_Publish
+ self.ftp = self.getPublisher(FTP_PUBLISHER).cp_Publish
self.getPublisher(FTP_PUBLISHER).cp_Publish = False
except Exception: