# HG changeset patch # User Goffi # Date 1448404015 -3600 # Node ID 34f066ed3b23a190faf83d93bc6b8228f4c2a665 # Parent f725cc49e9969c2a63f7d1016b41bd5176479b5f browser_side: replaced mbdata2tags and tags2mbdata by sat.tools.common.dict2iter and iter2dict diff -r f725cc49e996 -r 34f066ed3b23 src/browser/sat_browser/richtext.py --- a/src/browser/sat_browser/richtext.py Tue Nov 24 22:49:25 2015 +0100 +++ b/src/browser/sat_browser/richtext.py Tue Nov 24 23:26:55 2015 +0100 @@ -21,6 +21,7 @@ from sat.core.i18n import _ from sat.core.log import getLogger log = getLogger(__name__) +from sat.tools import common from pyjamas.ui.TextArea import TextArea from pyjamas.ui.Button import Button @@ -39,8 +40,6 @@ import html_tools import list_manager -from sat_frontends.quick_frontend import quick_blog - class RichTextEditor(editor_widget.BaseTextEditor, FlexTable): """Panel for the rich text editor.""" @@ -100,7 +99,7 @@ self.display = editor_widget.HTMLTextEditor(options={'enhance_display': False, 'listen_keyboard': False}) # for display mode for listener in self.edit_listeners: self.display.addEditListener(listener) - + if not self.read_only and not hasattr(self, 'textarea'): self.textarea = EditTextArea(self) # for edition mode self.textarea.addStyleName(self.STYLE['textarea']) @@ -266,7 +265,7 @@ if hasattr(self, 'title_panel'): content.update({'title': self.strproc(self.title_panel.getText())}) if hasattr(self, 'tags_panel'): - content.update(quick_blog.tags2mbdata(self.tags_panel.getTags())) + common.iter2dict('tag', self.tags_panel.getTags(), content) return content def edit(self, edit=False, abort=False, sync=False): @@ -297,13 +296,13 @@ content.update({'text': text}) content.update({'syntax': syntax}) self.textarea.setText(content['text']) - + if hasattr(self, 'title_panel') and 'title' in content: self.title_panel.setText(content['title']) self.title_panel.setStackVisible(0, content['title'] != '') if hasattr(self, 'tags_panel'): - tags = quick_blog.mbdata2tags(content) + tags = list(common.dict2iter('tag', content)) self.tags_panel.setTags(tags) self.tags_panel.setStackVisible(0, len(tags) > 0) @@ -325,7 +324,7 @@ text = content['text'] if 'title' in content and content['title']: text = '

%s

%s' % (html_tools.html_sanitize(content['title']), text) - tags = quick_blog.mbdata2tags(content) + tags = list(common.dict2iter('tag', content)) if tags: # FIXME: display it more beautiful text = '%s

%s %s

' % (text, _("Tags:"), html_tools.html_sanitize(", ".join(tags))) self.display.setContent({'text': text})