Thanks Jasha.

I am currently doing exactly what you described. However, since we have
different document types that may require different sizes of the
htmlarea, I am trying to find a way to make the htmlarea configurable
through the layout.xml rather than introducing a new htmlarea.js for
every different size.

I thought about modifying the initFunc so it takes width and height as
parameters just like ID. However, it seems that in
editing/cf2/resources/js/htmlarea-functions.js, the ID and initFunc are
put in two different arrays and their only association was by the index
number. With the hesitation of making major changes to the xsl to suit
my need, I found the following segment in
editing/cf2/transformers/cforms-hippocms-styling.xsl. It seems that I
could do some ad hoc configuration to the htmlarea initialization. But
it didn't seem to work for me. Any thoughts?

  <xsl:apply-templates select="." mode="common"/>
  <xsl:choose>
    <xsl:when test="fi:styling/conf">
      <!-- use an 'ad hoc'  configuration -->
      <script  type="text/javascript">
        var handler = new Object();
        handler.fieldId = "<xsl:value-of select="@id"/>";
        handler.forms_onload = function() {
        var id = "<xsl:value-of select="@id"/>";
        var textarea = document.getElementById(id);
        var editor = new HTMLArea(id);
        textarea.htmlarea = editor;
        var conf = editor.config;
        <xsl:value-of select="fi:styling/conf/text()"/>
        editor.generate();
        }
        forms_onloadHandlers.push(handler);
      </script>
    </xsl:when>
    <!-- use a passed configuration function -->
    <xsl:when test="fi:styling/initFunction and not(fi:styling/conf)">
      <script  type="text/javascript">
          myGeneratableAreas.queuePut('<xsl:value-of
select="@id"/>',<xsl:value-of select="fi:styling/initFunction"/>);
        </script>
    </xsl:when>
    <!-- default mode with all buttons available -->
    <xsl:otherwise>
      <script  type="text/javascript">
        var handler = new Object();
        handler.fieldId = "<xsl:value-of select="@id"/>";
        handler.forms_onload = function() {
        HTMLArea.replace('<xsl:value-of select="@id"/>');
        }
        forms_onloadHandlers.push(handler);
      </script>
    </xsl:otherwise>
  </xsl:choose>
  </xsl:template>

Regards,
Jun
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jasha
Joachimsthal
Sent: Monday, January 26, 2009 11:10 PM
To: Hippo CMS development public mailinglist
Subject: RE: [HippoCMS-dev] htmlarea configuration

Hi Jun,

Config.width and config.height are set in the Javascript function that
you call as HTMLArea. If you look at the default configuration (file is
located at editor/src/site/editing/cf2/resources/js/htmlarea.js) you'll
find config.height = "200px"; and config.width = "600px";
The location of the Javascript can be changed in you business logic. The
default is:
  <libs>
    <lib src="/editing/cf2/js/htmlarea.js"/>
  </libs>

Regards,


Jasha Joachimsthal 
 
[email protected] - [email protected]
 
www.onehippo.com
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-5100 +1 (707) 773-4646




> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> [email protected]
> Sent: maandag 26 januari 2009 23:33
> To: [email protected]
> Subject: [HippoCMS-dev] htmlarea configuration
> 
> Hi guys,
> 
> I am trying to configure the width & height of a htmlarea. I 
> dug into the xslt and found that I should probably be able to 
> do it by adding a conf attribute in layout.xml like this:
> 
> Eg: <htmlfield id="/root/myhtml" class="myDemoHtmlArea"
> conf="conf.width='600px';conf.height='300px'"
> initFunc="myHtmlArea"/></cell>
> 
> 
> I thought it would work but it didn't. And I approaching it correctly?
> It seems the match for <xsl:when test="fi:styling/conf">
> 
> in editing/cf2/transformers/cforms-hippocms-styling.xsl 
> wasn't able to pick up conf. Any suggestions?
> 
>  
> 
> Thanks
> 
> Jun 
> 
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
> 
> Searchable archives can be found at:
> MarkMail: http://hippocms-dev.markmail.org
> Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
> 
> 
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html


********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html

Reply via email to