115 |
115 |
116 def get_ajax_output(self, changes): |
116 def get_ajax_output(self, changes): |
117 output = super(IllustrationPropertiesAJAXEditForm, self).get_ajax_output(changes) |
117 output = super(IllustrationPropertiesAJAXEditForm, self).get_ajax_output(changes) |
118 if 'title' in changes.get(IIllustration, ()): |
118 if 'title' in changes.get(IIllustration, ()): |
119 output.setdefault('events', []).append({ |
119 output.setdefault('events', []).append({ |
120 'event': 'PyAMS_content.changed_item', |
120 'event': 'myams.refresh', |
121 'options': {'handler': 'PyAMS_content.paragraphs.refreshParagraph', |
121 'options': { |
122 'object_name': self.context.__name__, |
122 'handler': 'PyAMS_content.paragraphs.refreshParagraph', |
123 'title': II18n(self.context).query_attribute('title', request=self.request), |
123 'object_name': self.context.__name__, |
124 'visible': self.context.visible} |
124 'title': II18n(self.context).query_attribute('title', request=self.request), |
|
125 'visible': self.context.visible |
|
126 } |
125 }) |
127 }) |
126 return output |
128 return output |
127 |
129 |
128 |
130 |
129 @adapter_config(context=(IIllustrationParagraph, IPyAMSLayer), provides=IParagraphInnerEditor) |
131 @adapter_config(context=(IIllustrationParagraph, IPyAMSLayer), provides=IParagraphInnerEditor) |
150 def get_ajax_output(self, changes): |
152 def get_ajax_output(self, changes): |
151 output = super(IllustrationInnerAJAXEditForm, self).get_ajax_output(changes) |
153 output = super(IllustrationInnerAJAXEditForm, self).get_ajax_output(changes) |
152 updated = changes.get(IIllustration, ()) |
154 updated = changes.get(IIllustration, ()) |
153 if 'title' in updated: |
155 if 'title' in updated: |
154 output.setdefault('events', []).append({ |
156 output.setdefault('events', []).append({ |
155 'event': 'PyAMS_content.changed_item', |
157 'event': 'myams.refresh', |
156 'options': {'handler': 'PyAMS_content.paragraphs.refreshParagraph', |
158 'options': { |
157 'object_name': self.context.__name__, |
159 'handler': 'PyAMS_content.paragraphs.refreshParagraph', |
158 'title': II18n(self.context).query_attribute('title', request=self.request), |
160 'object_name': self.context.__name__, |
159 'visible': self.context.visible} |
161 'title': II18n(self.context).query_attribute('title', request=self.request), |
|
162 'visible': self.context.visible |
|
163 } |
160 }) |
164 }) |
161 if 'data' in updated: |
165 if 'data' in updated: |
162 # we have to commit transaction to be able to handle blobs... |
166 # we have to commit transaction to be able to handle blobs... |
163 ITransactionManager(self.context).get().commit() |
167 ITransactionManager(self.context).get().commit() |
164 form = IllustrationInnerEditForm(self.context, self.request) |
168 form = IllustrationInnerEditForm(self.context, self.request) |
165 form.update() |
169 form.update() |
166 output.setdefault('events', []).append({ |
170 output.setdefault('events', []).append({ |
167 'event': 'PyAMS_content.changed_item', |
171 'event': 'myams.refresh', |
168 'options': {'handler': 'PyAMS_content.refreshForm', |
172 'options': { |
169 'object_name': '{0}_{1}_{2}'.format( |
173 'object_id': '{0}_{1}_{2}'.format( |
170 self.context.__class__.__name__, |
174 self.context.__class__.__name__, |
171 getattr(form.getContent(), '__name__', 'noname').replace('++', ''), |
175 getattr(form.getContent(), '__name__', 'noname').replace('++', ''), |
172 form.id), |
176 form.id), |
173 'form': form.render()} |
177 'content': form.render() |
|
178 } |
174 }) |
179 }) |
175 return output |
180 return output |
176 |
181 |
177 |
182 |
178 # |
183 # |