Re: Bug: kupusilvatools.js: "Code source is not allowed inside a header" error
Marc Petitmermet <[email protected]> Mon, 12 Nov 2007 13:35:42 +0100
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <[email protected]> |
thanks andy, for the fast fix; works perfectly.
regards,
marc
On 11. Nov 2007, at 21:43 Uhr, Andy Altepeter wrote:
> Hi Marc,
>
> Thanks for your thorough investigation into this error!
>
> I recently did some work on the external source kupu tool in the
> Silva trunk.
> I did happen to notice this behavior, and at the time I did fix it.
> However,
> I did not port this fix back to the 2.0 branch.
>
> I've just done so. If you want to test it, you can check out the
> 2.0 branch.
> Otherwise this will be fixed in the next 2.0 bugfix release.
>
> Take care,
> Andy
>
> On Sunday 11 November 2007 05:54, Marc Petitmermet wrote:
>> i was creating a new code source with LookupWindowField or
>> ReferenceLookupWindowField. and then i was fighting with the error
>> "Code source is not allowed inside a header". inside what header,
>> please? i have the code source within the body. i also noted that i
>> don't get the error all the times.
>>
>> so here is my analysis which is hopefully too wrong;-)
>>
>> i finally could figure out in which case i get an error and in which
>> not. in kupu, a code source is represented with a line containing the
>> title and a line containing the parameters and the yellow background.
>> to edit the parameters of a code source, one has to click with the
>> mouse somewhere in yellow area. at random one sometimes clicks on the
>> line with the title and sometimes on the line with the parameters.
>> and
>> every time i click on the line with the title of the code source i
>> get
>> the "Code source is not allowed inside a header". no error when
>> clicking on the parameter line.
>>
>> the error probably lies in the
>> SilvaExternalSourceTool.prototype.startExternalSourceAddEdit function
>> in the javascript Silva/kupu/kupusilvatools.js. this function checks
>> if you place a code source within a header or table which is not
>> allowed. therefore, it verifies the parenting tags. and here lies the
>> error: the paraenting tags are <h4></h4> in kupu when clicking in the
>> line with the tile and this is not allowed and therefore the error.
>>
>> SilvaExternalSourceTool.prototype.startExternalSourceAddEdit =
>> function() {
>> // you should not be allowed to add external sources inside
>> // headers or table cells
>> var selNode = this.editor.getSelectedNode();
>> var not_allowed_parent_tags = ['H1', 'H2', 'H3', 'H4', 'H5',
>> 'H6'];
>> for (i=0; i < not_allowed_parent_tags.length; i++){
>> if (selNode.tagName == not_allowed_parent_tags[i]){
>> alert('Code source is not allowed inside a header.')
>> return
>> }
>> }
>> [snip]
>>
>> to avoid this error selNode should not be the parant node but the
>> great parent node which is the enclosing <div> of the code source:
>>
>> <div parameter="value" class="externalsource"
>> source_id="mycodesource">
>> <h4>Silva Code Source «foo»</h4> parameter: value<br></div>
>>
>> if my analysis is correct a simple change in the line
>>
>> var selNode = this.editor.getSelectedNode();
>>
>> should fix this error. i don't know javascript at all so i leave it
>> to
>> you developers;-)
>>
>> regards,
>> marc
>>
>>
>> _______________________________________________
>> silva-dev mailing list
>> silva-dev-IAPFreCvJWM6s/[email protected]
>> https://lists.infrae.com/mailman/listinfo/silva-dev
>
> _______________________________________________
> silva-dev mailing list
> silva-dev-IAPFreCvJWM6s/[email protected]
> https://lists.infrae.com/mailman/listinfo/silva-dev