[Checkins] SVN: GenericSetup/trunk/ Rework extension profile
handling in the ZMI. In the import screen you can
Wichert Akkerman
wichert at wiggy.net
Fri Jul 6 09:27:42 EDT 2007
Log message for revision 77502:
Rework extension profile handling in the ZMI. In the import screen you can
now choose to import from the base profile or one of the registered extension
profiles.
Changed:
U GenericSetup/trunk/tool.py
U GenericSetup/trunk/www/sutImportSteps.zpt
U GenericSetup/trunk/www/sutProperties.zpt
-=-
Modified: GenericSetup/trunk/tool.py
===================================================================
--- GenericSetup/trunk/tool.py 2007-07-06 13:07:28 UTC (rev 77501)
+++ GenericSetup/trunk/tool.py 2007-07-06 13:27:42 UTC (rev 77502)
@@ -218,10 +218,15 @@
""" See ISetupTool.
"""
self._baseline_context_id = context_id
+ self.applyContextById(context_id, encoding)
+
+
+ security.declareProtected(ManagePortal, 'applyContextById')
+ def applyContextById(self, context_id, encoding=None):
context = self._getImportContext(context_id)
-
self.applyContext(context, encoding)
+
security.declareProtected(ManagePortal, 'applyContext')
def applyContext(self, context, encoding=None):
self._updateImportStepsRegistry(context, encoding)
@@ -471,7 +476,7 @@
manage_importSteps = PageTemplateFile('sutImportSteps', _wwwdir)
security.declareProtected(ManagePortal, 'manage_importSelectedSteps')
- def manage_importSelectedSteps(self, ids, run_dependencies):
+ def manage_importSelectedSteps(self, ids, run_dependencies, context_id=None):
""" Import the steps selected by the user.
"""
messages = {}
@@ -479,11 +484,13 @@
summary = 'No steps selected.'
else:
+ if context_id is None:
+ context_id = self.getBaselineContextID()
steps_run = []
for step_id in ids:
- result = self.runImportStepFromProfile(
- self.getBaselineContextID(),
- step_id, run_dependencies)
+ result = self.runImportStepFromProfile(context_id,
+ step_id,
+ run_dependencies)
steps_run.extend(result['steps'])
messages.update(result['messages'])
@@ -496,11 +503,12 @@
messages=messages)
security.declareProtected(ManagePortal, 'manage_importSelectedSteps')
- def manage_importAllSteps(self):
+ def manage_importAllSteps(self, context_id=None):
""" Import all steps.
"""
- context_id = self.getBaselineContextID()
+ if context_id is None:
+ context_id = self.getBaselineContextID()
result = self.runAllImportStepsFromProfile(context_id, purge_old=None)
steps_run = 'Steps run: %s' % ', '.join(result['steps'])
Modified: GenericSetup/trunk/www/sutImportSteps.zpt
===================================================================
--- GenericSetup/trunk/www/sutImportSteps.zpt 2007-07-06 13:07:28 UTC (rev 77501)
+++ GenericSetup/trunk/www/sutImportSteps.zpt 2007-07-06 13:27:42 UTC (rev 77502)
@@ -1,3 +1,9 @@
+<tal:block define="base_context_id context/getBaselineContextID;
+ context_id request/context_id|base_context_id;
+ contexts context/listContextInfos;
+ context_title python:[c['title'] for c in contexts if c['id']==context_id][0];
+ extension_contexts python:[c for c in contexts if c['type']=='extension'];
+ ">
<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:define="manage_tabs_message options/manage_tabs_message | nothing"
tal:replace="structure context/manage_tabs">TABS</h2>
@@ -9,10 +15,30 @@
procedure, in order to pick up changes since the site was created.
</p>
-<h3>Available Import Steps</h3>
+<h3>Select Profile</h3>
+<form action="." method="POST">
+<select name="context_id">
+ <option value=""
+ tal:attributes="value base_context_id;
+ selected python:context_id==base_context_id">
+ Current base profile</option>
+ <option value="context-CONTEXT_ID"
+ tal:repeat="context extension_contexts"
+ tal:attributes="value context/id; selected python:context_id==context['id']"
+ tal:content="context/title">CONTEXT_TITLE</option>
+</select>
+ <input class="form-element" type="submit"
+ name="manage_importSteps:method"
+ value="Switch profile" />
+</form>
+
+
+<h3>Available Import Steps for "<span tal:replace="context_title">Base profile</span>"</h3>
+
<form action="." method="POST" enctype="multipart/form-data"
tal:attributes="action context/absolute_url" >
+<tal:dummy define="dummy python:context.applyContextById(context_id)"/>
<input type="hidden" name="ids:default:tokens" value="" />
<table cellspacing="0" cellpadding="4">
@@ -57,6 +83,7 @@
<td />
<td colspan="3">
+ <input type="hidden" name="context_id" value="" tal:attributes="value context_id"/>
<input type="hidden" name="run_dependencies:int:default" value="0" />
<input class="form-element" type="checkbox" id="run_dependencies"
name="run_dependencies:boolean" value="1" checked="checked" />
@@ -100,3 +127,5 @@
</form>
<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
+</tal:block>
+
Modified: GenericSetup/trunk/www/sutProperties.zpt
===================================================================
--- GenericSetup/trunk/www/sutProperties.zpt 2007-07-06 13:07:28 UTC (rev 77501)
+++ GenericSetup/trunk/www/sutProperties.zpt 2007-07-06 13:27:42 UTC (rev 77502)
@@ -67,28 +67,6 @@
value="Update Base Profile" />
</div>
</fieldset>
-
- <fieldset id="extesions_fs">
- <legend>Extension Profiles</legend>
- <p tal:repeat="extension exts">
- <tal:whatever
- tal:define="fid string:extension_${extension/id};
- last python:context.getProfileImportDate(extension['id']);
- ">
- <input type="checkbox" id="extension_0" name="profile_ids:list" value="waaa"
- tal:attributes="id fid;
- value extension/id;
- "/>
- <label tal:content="extension/title">TITLE</label>
- <span class="info"
- tal:condition="last">
- Last imported <tal:x tal:content="last">TIMESTAMP</tal:x></span>
- </tal:whatever>
- </p>
- <p><input type="submit" name="manage_importExtensions:method"
- value="Import Selected Extensions" /></p>
- </fieldset>
-
</form>
</div>
More information about the Checkins
mailing list