Changeset 3403 in products for quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/browser/plonetabs.py
- Timestamp:
- Apr 3, 2012 11:40:34 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/browser/plonetabs.py
r3402 r3403 24 24 from Products.statusmessages.interfaces import IStatusMessage 25 25 26 from quintagroup.plonetabs.config import *26 from quintagroup.plonetabs.config import PROPERTY_SHEET, FIELD_NAME 27 27 from quintagroup.plonetabs import messageFactory as _ 28 28 from interfaces import IPloneTabsControlPanel … … 61 61 postback = True 62 62 errors = {} 63 context = aq_inner(self.context)64 63 65 64 form = self.request.form 66 action = form.get("action", "")67 65 submitted = form.get('form.submitted', False) 68 66 … … 430 428 actions = getMultiAdapter((self.context, self.request), 431 429 name=u'plone_context_state').actions() 430 actions_tabs = [] 432 431 try: 433 432 # Plone 4 and higher 434 433 import plone.app.upgrade 435 if 'portal_tabs' in actions: 436 actions_tabs = actions['portal_tabs'] 437 else: 438 actions_tabs = [] 434 plone.app.upgrade # pyflakes 439 435 except ImportError: 440 436 actions_tabs = actions 437 if not actions_tabs and 'portal_tabs' in actions: 438 actions_tabs = actions['portal_tabs'] 441 439 442 440 portal_tabs_view = getMultiAdapter((self.context, self.request), … … 540 538 541 539 if obj_id not in portal.objectIds(): 542 raise KSSExplicitError, \ 543 _(u"Object with '${id}' id doesn't exist in portal root.", 544 mapping={'id': obj_id}) 540 raise KSSExplicitError("Object with %s id doesn't" +\ 541 " exist in portal root." % obj_id) 545 542 546 543 if checked == '1': … … 624 621 # if not errors find (or create) category and set action to it 625 622 ksscore = self.getCommandSet('core') 626 kssplone = self.getCommandSet('plone')627 623 if not errors: 628 624 action = self.addAction(cat_name, data) … … 753 749 html_id = '%s%s%s' % (self.prefix, id, self.sufix) 754 750 ksscore = self.getCommandSet('core') 755 kssplone = self.getCommandSet('plone')756 751 if not errors: 757 752 action = self.updateAction(id, cat_name, data) … … 978 973 category = self.getActionCategory(cat_name) 979 974 except Exception: 980 raise KSSExplicitError, \ 981 _(u"'${cat_name}' action category does not exist.", 982 mapping={'cat_name': cat_name}) 975 raise KSSExplicitError(u"%s action category does not exist." %\ 976 cat_name) 983 977 984 978 # extract action id from given list item id on client … … 988 982 action = category[action_id] 989 983 except Exception: 990 raise KSSExplicitError, \ 991 _(u"No '${id}' action in '${cat_name}' category.", 992 mapping={'id': action_id, 'cat_name': cat_name}) 984 raise KSSExplicitError("No %s action in %s category." %\ 985 (action_id, cat_name)) 993 986 994 987 return (action_id, category, action) … … 1034 1027 selector) 1035 1028 if collapsed is not None: 1036 data =command.addParam('collapsed', collapsed)1029 command.addParam('collapsed', collapsed) 1037 1030 if expanded is not None: 1038 data =command.addParam('expanded', expanded)1031 command.addParam('expanded', expanded) 1039 1032 if collapse is not None: 1040 data =command.addParam('collapse', collapse)1033 command.addParam('collapse', collapse) 1041 1034 1042 1035 def kss_resetForm(self, selector): 1043 1036 """KSS Server command to reset form on client""" 1044 command = self.commands.addCommand('plonetabs-resetForm', selector)1045 1037 1046 1038 def kss_blur(self, selector): 1047 1039 """KSS Server command to remove focus from input""" 1048 command =self.commands.addCommand('plonetabs-blur', selector)1040 self.commands.addCommand('plonetabs-blur', selector) 1049 1041 1050 1042 def kss_replaceOrInsert(self, selector, parentSelector, html, … … 1055 1047 command = self.commands.addCommand('plonetabs-replaceOrInsert', 1056 1048 selector) 1057 data =command.addParam('selector', parentSelector)1058 data =command.addHtmlParam('html', html)1059 data =command.addParam('withKssSetup', withKssSetup)1049 command.addParam('selector', parentSelector) 1050 command.addHtmlParam('html', html) 1051 command.addParam('withKssSetup', withKssSetup) 1060 1052 if alternativeHTML: 1061 data =command.addHtmlParam('alternativeHTML', alternativeHTML)1053 command.addHtmlParam('alternativeHTML', alternativeHTML) 1062 1054 if selectorType: 1063 data =command.addParam('selectorType', selectorType)1055 command.addParam('selectorType', selectorType) 1064 1056 if position: 1065 data =command.addParam('position', position)1057 command.addParam('position', position) 1066 1058 if positionSelector: 1067 data =command.addParam('positionSelector', positionSelector)1059 command.addParam('positionSelector', positionSelector) 1068 1060 if positionSelectorType: 1069 data =command.addParam('positionSelectorType',1070 1061 command.addParam('positionSelectorType', 1062 positionSelectorType) 1071 1063 1072 1064 def kss_issueMessage(self, message, msgtype="info"): … … 1083 1075 def kss_timeout(self, selector, **kw): 1084 1076 """KSS Server command to execute plonetabs-timeout client action""" 1085 command =self.commands.addCommand('plonetabs-timeout', selector, **kw)1077 self.commands.addCommand('plonetabs-timeout', selector, **kw) 1086 1078 1087 1079 def renderViewlet(self, manager, name):
Note: See TracChangeset
for help on using the changeset viewer.