[opencms-dev] Adding a new type of Gallery to the Editor

Daniel Rhoden drhoden at iiwinc.com
Tue Feb 15 18:49:52 CET 2005


This was very helpful.  Could you give me your thoughts about this:

Rather than using special comments to embed the custom actions, why not 
use the standard HTML <object/> tag?  The same title example might look 
like this:

<h1><object name="aUniqueNameForInclude">
    <param name="file" value="/sites/default/content/xy.html" />
    <param name="element" value="title" />
</object></h1>

I might be missing required attributes, but I think the concept is solid 
(given a few more hacks).  CSS could be applied to make a place holder 
appear for the object.  Then runtime the object would be replaced with 
the appropriate data.

--Daniel Rhoden

Alexander Kandzior wrote:

>Daniel,
>
>Some more details that may hopefully help you:
>
>The WYSIWYG is basically an external component. Within IE it always is the
>MS DHTML Editing control, in Mozilla it's some sort of Mozilla/Firefox
>function similar to this. These controls only handle "standard" HTML
>(whatever they think it is). So there is no way of adding new HTML tags that
>are supported by this controls. Some kind of workaround for "special markup"
>must be used therefore, like HTML comments hiding the "dynamic" information
>like which XML content object contains the information. 
>
>The editing control HTML is send to the server when you press "save". At
>that point it's just some plain HTML. On the server this HTML is analyzed
>for links by a open source component called "HTML parser" (see the project
>on sourceforge).
>
>The HTML parser extracty all links in a HREF or IMG SRC tags by parsing the
>HTML, and replaces them with these macros strings. This link processing is
>required for adjusting the links for static export and also for link
>checking. 
>
>In the end of the process, there's a data structure called the "link table"
>which holds all links in the HTML that was edited, referenced by the macro
>names. Then the XML structure you can see in the control code is just a
>serialization of this HTML plus link table. 
>
>To have that reference structure as you described it, it would be required
>to extend the HTML parsing process to recognize that "special" markup that
>was inserted in the editor. Then the parser would have to replace that
>"special markup" as it does with the links. 
>
>To give you an example, the "special markup" could be something like this:
>
>Suppose you add a reference to the "Title" element of the
>"/sites/default/content/xy.html" file. That is what the HTML source coude
>could look like:
>
><h1><!-- XML-Content-Ref file="/sites/default/content/xy.html"
>element="Title" -->Here's the value of the title<!-- /XML-Content-Red
>--></h1>
>
>The "only" thing required (besided generating a gallery that adds this HTML,
>which should be easy) is to extend the HTML parsing process to recognize
>this "special markup" and replace it with a simple macro. 
>
>So the approach outlined here comes down pretty much to that HTML parser
>element. Unfortunatly this HTML parser I don't know that much so I can't
>give any hints on how to parse this. AFAIK the project has an active mailing
>list on sourceforge.
>
>Best Regards,
>Alex.
>
>Alexander Kandzior
>Alkacon Software - The OpenCms Experts
>http://www.alkacon.com
>
> 
>
>  
>
>>-----Original Message-----
>>From: opencms-dev-bounces at opencms.org 
>>[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Daniel Rhoden
>>Sent: Monday, February 14, 2005 7:03 PM
>>To: The OpenCms mailing list
>>Subject: Re: [opencms-dev] Adding a new type of Gallery to the Editor
>>
>>Wonderful feedback.  Thank you!
>>You are correct. "Gallery like references to XML contents" is 
>>a much better way of describing it. 
>>
>>I have the feeling that there are factors regarding the 
>>WYSIWYG editor that I am not aware (which is fine, we all 
>>have to learn).  I am under the impression that the WYSIWYG 
>>editor was specifically for XML content items.  Are you 
>>suggesting that under certain circumstances that there would 
>>be problems if the WYSIWYG editor's interface was enhanced to 
>>provide access to such a feature?
>>
>>Let me describe how I envision using such a feature:  The 
>>templates, elements, and default_bodies would already be 
>>defined.  After creating a new XML page I would view the page 
>>Offline, click on the direct edit square (in version 6) for 
>>the section specified for the article's headline and define 
>>the content (there are reasons why I'm not using custom 
>>properties instead).  On another page, I would do the same 
>>process, but in the content area.  I would then describe a 
>>reference to the fist page, but want to display its exact 
>>headline in my link's anchor text.  Rather than typing it and 
>>risking a synchronization issue (say, the headline gets 
>>updated by a different writer), I would click on the button 
>>that would allow me to reference other pages' elements, and 
>>drop a reference to it.  The page would appear to have 
>>content in it at runtime.  The control code for the page 
>>would have a new <references/> node just under the <links/> 
>>node, and a ${ref0} statement would be inserted into the content node.
>>
>>Sorry that was so long, but I know it is hard to paint the 
>>same picture in other people's mind
>>
>>Thanks,
>>
>>Daniel Rhoden.
>>
>>Alexander Kandzior wrote:
>>
>>    
>>
>>>Daniel,
>>>
>>>Such a kind of gallery will IMHO be possible only for XML content 
>>>items, not inside the WYSIWYG editor. This is because of the 
>>>      
>>>
>>structure 
>>    
>>
>>>of the HTML editable element used for the WYSIWYG.
>>>
>>>In this case the task is better described as "building a XML content 
>>>widget for content references".
>>>
>>>The code base of the galleries should be usable for this. 
>>>      
>>>
>>The galleries 
>>    
>>
>>>already share most of the code as well as the JSP pages. 
>>>      
>>>
>>Have a look at 
>>    
>>
>>>the package "org.opencms.workplace.galleries", there is an 
>>>      
>>>
>>abtract base 
>>    
>>
>>>class called "A_CmsGallery" from which all Galleries are 
>>>      
>>>
>>extended. It 
>>    
>>
>>>basically comes down to writing some 100-200 LOC, mainly to 
>>>      
>>>
>>generate the list view.
>>    
>>
>>>I can give some more details about the other tasks required. 
>>>      
>>>
>>Before I 
>>    
>>
>>>do please let me know if this is actually what you want 
>>>      
>>>
>>(Gallery like 
>>    
>>
>>>references for XML contents, not for the WYSIWYG editor).
>>>
>>>Best Regards,
>>>Alex.
>>>
>>>Alexander Kandzior
>>>Alkacon Software - The OpenCms Experts
>>>http://www.alkacon.com
>>>
>>>
>>>
>>> 
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: opencms-dev-bounces at opencms.org 
>>>>[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Daniel Rhoden
>>>>Sent: Monday, February 14, 2005 5:47 PM
>>>>To: The OpenCms mailing list
>>>>Subject: [opencms-dev] Adding a new type of Gallery to the Editor
>>>>
>>>>I would like to add a new type of Gallery accessible from 
>>>>        
>>>>
>>the editor 
>>    
>>
>>>>to make references to other XML page' content elements.  It 
>>>>        
>>>>
>>should not 
>>    
>>
>>>>act like the HTML Gallery in which a COPY is made, but more 
>>>>        
>>>>
>>like the 
>>    
>>
>>>><cms:include page=""
>>>>element=""> tag, in which a REFERENCE is made. I think 
>>>>        
>>>>
>>there are many 
>>    
>>
>>>>uses for such a feature (though the term 'gallery'
>>>>may not be appropriate). 
>>>>
>>>>1. Can we post an outline for building custom "galleries"?
>>>>2. Can we post ways to achieve a "Reference Gallery" 
>>>>        
>>>>
>>mentioned above?
>>    
>>
>>>>Thanks,
>>>>
>>>>--Daniel Rhoden
>>>>
>>>>
>>>>_______________________________________________
>>>>This mail is send to you from the opencms-dev mailing list 
>>>>        
>>>>
>>To change 
>>    
>>
>>>>your list options, or to unsubscribe from the list, please visit 
>>>>http://mail.opencms.org/mailman/listinfo/opencms-dev
>>>>
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>
>>>_______________________________________________
>>>This mail is send to you from the opencms-dev mailing list To change 
>>>your list options, or to unsubscribe from the list, please visit 
>>>http://mail.opencms.org/mailman/listinfo/opencms-dev
>>>
>>> 
>>>
>>>      
>>>
>>_______________________________________________
>>This mail is send to you from the opencms-dev mailing list To 
>>change your list options, or to unsubscribe from the list, 
>>please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
>>
>>
>>    
>>
>
>
>
>_______________________________________________
>This mail is send to you from the opencms-dev mailing list
>To change your list options, or to unsubscribe from the list, please visit
>http://mail.opencms.org/mailman/listinfo/opencms-dev
>
>  
>



More information about the opencms-dev mailing list