Commit ff82a7a7 authored by Ivan Tyagov's avatar Ivan Tyagov

Add simple progress bar.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23925 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 08b035fc
...@@ -50,6 +50,9 @@ from Products.PluggableAuthService.interfaces.plugins import IAuthenticationPlug ...@@ -50,6 +50,9 @@ from Products.PluggableAuthService.interfaces.plugins import IAuthenticationPlug
# global (RAM) cookie storage # global (RAM) cookie storage
cookiejar = cookielib.CookieJar() cookiejar = cookielib.CookieJar()
referer = None referer = None
installation_status = {'bt5': {'current': 0,
'all': 0,},
'activity_list': [],}
def _isUserAcknowledged(cookiejar): def _isUserAcknowledged(cookiejar):
""" Is user authenticated to remote system through a cookie. """ """ Is user authenticated to remote system through a cookie. """
...@@ -459,6 +462,7 @@ class WizardTool(BaseTool): ...@@ -459,6 +462,7 @@ class WizardTool(BaseTool):
install_customer_bt5=True, install_customer_bt5=True,
use_super_manager=True): use_super_manager=True):
""" Install or update BT5 files which we get from remote server. """ """ Install or update BT5 files which we get from remote server. """
global installation_status
if use_super_manager: if use_super_manager:
# set current security manager to owner of site # set current security manager to owner of site
_setSuperSecurityManager(self.getPortalObject()) _setSuperSecurityManager(self.getPortalObject())
...@@ -470,6 +474,7 @@ class WizardTool(BaseTool): ...@@ -470,6 +474,7 @@ class WizardTool(BaseTool):
counter = 0 counter = 0
LOG("Wizard", INFO, LOG("Wizard", INFO,
"Starting installation for %s" %' '.join(bt5_filenames)) "Starting installation for %s" %' '.join(bt5_filenames))
installation_status['bt5']['all'] = len(bt5_files)
#execute_after_setup_script = install_standard_bt5 = install_customer_bt5 = False # dev mode #execute_after_setup_script = install_standard_bt5 = install_customer_bt5 = False # dev mode
for bt5_id in bt5_filenames: for bt5_id in bt5_filenames:
if bt5_id.startswith('http://'): if bt5_id.startswith('http://'):
...@@ -477,6 +482,7 @@ class WizardTool(BaseTool): ...@@ -477,6 +482,7 @@ class WizardTool(BaseTool):
if install_standard_bt5: if install_standard_bt5:
bt = portal_templates.download(bt5_id) bt = portal_templates.download(bt5_id)
bt.install() bt.install()
installation_status['bt5']['current'] = counter + 1
LOG("Wizard", INFO, LOG("Wizard", INFO,
"[OK] standard bt5 installation (HTTP) from %s" %bt5_id) "[OK] standard bt5 installation (HTTP) from %s" %bt5_id)
else: else:
...@@ -484,6 +490,7 @@ class WizardTool(BaseTool): ...@@ -484,6 +490,7 @@ class WizardTool(BaseTool):
if install_customer_bt5: if install_customer_bt5:
bt5_filedata = bt5_files[counter] bt5_filedata = bt5_files[counter]
self._importBT5FileData(bt5_id, bt5_filedata) self._importBT5FileData(bt5_id, bt5_filedata)
installation_status['bt5']['current'] = counter + 1
LOG("Wizard", INFO, LOG("Wizard", INFO,
"[OK] customized bt5 installation (XML-RPC) %s, %s bytes" % "[OK] customized bt5 installation (XML-RPC) %s, %s bytes" %
(bt5_id, len(bt5_filedata))) (bt5_id, len(bt5_filedata)))
...@@ -497,7 +504,6 @@ class WizardTool(BaseTool): ...@@ -497,7 +504,6 @@ class WizardTool(BaseTool):
## we already have stored after setup script id ## we already have stored after setup script id
bt5_after_setup_script_id = self.getExpressConfigurationPreference( bt5_after_setup_script_id = self.getExpressConfigurationPreference(
'preferred_express_after_setup_script_id', None) 'preferred_express_after_setup_script_id', None)
if execute_after_setup_script and bt5_after_setup_script_id is not None: if execute_after_setup_script and bt5_after_setup_script_id is not None:
## Execute script provided (if) in customer specific business template. ## Execute script provided (if) in customer specific business template.
bt5_customer_template_id = server_response["server_buffer"]['filenames'][-1] bt5_customer_template_id = server_response["server_buffer"]['filenames'][-1]
...@@ -655,12 +661,17 @@ class WizardTool(BaseTool): ...@@ -655,12 +661,17 @@ class WizardTool(BaseTool):
If installation is over the installation activities and reindexing If installation is over the installation activities and reindexing
activities should not exists. activities should not exists.
""" """
global installation_status
portal_activities = getToolByName(self.getPortalObject(), 'portal_activities') portal_activities = getToolByName(self.getPortalObject(), 'portal_activities')
if 0 == len(portal_activities.getMessageList()) and \ is_bt5_installation_over = (portal_activities.countMessageWithTag('initialERP5Setup')==0)
0 == portal_activities.countMessageWithTag('initialERP5Setup'): if 0 == len(portal_activities.getMessageList()) and is_bt5_installation_over:
html = self.WizardTool_successfulConfiguration() html = self.WizardTool_successfulConfiguration()
else: else:
html = self.WizardTool_viewRunningInstallationMessageRenderer() if is_bt5_installation_over:
# only if bt5s are installed start tracking number of activities
activity_list = portal_activities.getMessageList()
installation_status['activity_list'].append(len(activity_list))
html = self.WizardTool_viewRunningInstallationMessage(installation_status = installation_status)
return html return html
security.declarePublic(Permissions.AccessContentsInformation, 'getInstallationStatusReportFromServer') security.declarePublic(Permissions.AccessContentsInformation, 'getInstallationStatusReportFromServer')
...@@ -675,6 +686,11 @@ class WizardTool(BaseTool): ...@@ -675,6 +686,11 @@ class WizardTool(BaseTool):
""" Start installation process as an activity which will query generation server and """ Start installation process as an activity which will query generation server and
download/install bt5 template files and meanwhile offer user a nice GUI to observe download/install bt5 template files and meanwhile offer user a nice GUI to observe
what's happening. """ what's happening. """
global installation_status
# init installation status
installation_status['bt5']['all'] = 0
installation_status['bt5']['current'] = 0
installation_status['activity_list'] = []
active_process = self.portal_activities.newActiveProcess() active_process = self.portal_activities.newActiveProcess()
REQUEST.set('active_process_id', active_process.getId()) REQUEST.set('active_process_id', active_process.getId())
request_restore_dict = {'__ac_express': self.REQUEST.get('__ac_express', None),} request_restore_dict = {'__ac_express': self.REQUEST.get('__ac_express', None),}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment