Fw: [opencms-dev] xsd OpenCmsHtml editor

James Adams james at gamepub.com
Wed Jun 29 14:52:49 CEST 2005


Hi Marius,

I downloaded the htmlArea from the link you gave me and found the relevant example but I was unable to tranfer this to the htmlArea Opencms.  
I tried adjusting /system/workplace/resources/components/widgets/htmlarea.js by adding 

HTMLArea.loadPlugin("CSS");            (I don't really understand what this does, does this initialise CSS variable used later?)

Then code similar to that you gave and in example but I get a Javascript error.  Please see attached script file below.

Any ideas where I'm going wrong?  Do I need to add any new files to the CMS?

best wishes

James



--------------



/*
 * File   : $Source: $
 * Date   : $Date: $
 * Version: $Revision: $
 *
 * This library is part of OpenCms -
 * the Open Source Content Mananagement System
 *
 * Copyright (C) 2002 - 2005 Alkacon Software (http://www.alkacon.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * For further information about Alkacon Software, please see the
 * company website: http://www.alkacon.com
 *
 * For further information about OpenCms, please see the
 * project website: http://www.opencms.org
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
/*
 * These scripts are required for the html areas in the xml content editor
 */
 
// HTMLArea configuration
var config;
var htmlAreas = new Array();
var textAreas = new Array();


HTMLArea.loadPlugin("CSS");      ////////////////**************ADDED BY ME

function initHtmlAreas() {

 config = new HTMLArea.Config();
 config.toolbar = [
  [
   "copy", "cut", "paste", "separator",
   "bold", "italic", "underline", "separator",
   "strikethrough", "subscript", "superscript", "separator",
   "insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",
   "htmlmode"
  ]
 ];

 config.pageStyle = 
  'body { font-family:verdana, sans-serif; font-size:11px; font-weight:normal; margin: 0 0 0 0; padding: 1 1 1 1; border-width:2px; border-color:#FFF; border-style:inset; } ';

 // disable the status bar
 config.statusBar = false;

 // kill MS Word formatting on paste
 config.killWordOnPaste = true;
 
 // set autofocus to false to avoid jumping to last htmlarea
 config.autoFocus = false;

 var tas = document.getElementsByTagName("textarea");
 for (var i=0; i<tas.length; i++) {
  var idAttr = tas[i].getAttribute("id");
  if (idAttr != null && idAttr != "") {
   // only use textareas with "id" attribute value set
   textAreas[textAreas.length] = tas[i];
   var ha = new HTMLArea(tas[i], config);
   
/////////////////***************** ADDED BY ME
ha.config.pageStyle = "@import url(custom.css);";
        ha.registerPlugin(CSS, {
          combos : [
            { label: "style",
              options: { "style1"           : "",
                         "style2"          : "quote",
                         "style3"      : "highlight",
                         "style4"     : "deprecated"
                       }
            }
          ]
        });
        
/////////////***************** ADDED BY ME

   htmlAreas[htmlAreas.length] = ha;
   ha.generate();
  }
 }
}

function registerHtmlArea(id) {
}

function submitHtmlArea(form) {
 for (var i=0; i<textAreas.length; i++) {
  ta = textAreas[i];
  ha = htmlAreas[i];
  ta.value = encodeURIComponent(ha.getHTML());
 }
}










  ----- Original Message ----- 
  From: Marius Oancea 
  To: James Adams ; The OpenCms mailing list 
  Sent: Monday, June 27, 2005 5:08 PM
  Subject: Re: [opencms-dev] xsd OpenCmsHtml editor


  HTML Area has a CSS plugin that can be loaded and used /system/workplace/resources/components/widgets/htmlarea.js.

  You can use something like that :

  editor.registerPlugin(CSS, {
            combos : [
              { label: "Info",
                options: { "None"           : "",
                           "Atomic"          : "atomic"
                         }
              }
            ]
          });


  And in toolbar you can Add "CSS-class0" anywhere.

  Download htmlArea (http://www.dynarch.com/projects/htmlarea/) and look at the examples. There is one (dynamic_css.html) with exactly what you want.

  You will have to define the list of css classes to be used by your editors.

  You can even disallow bold, italic, font, size, .... if you define the right set of css classes.

      Marius

  James Adams wrote: 

    Thanks again Bruno.

    Does anyone know why that is?  

    Is there something that makes it particularly hard to implement in HTML/JScript etc?  I can't see why that is.
    Styles/CSS are a pretty common thing these days espeically in larger websites, which are exactly the kind that benefit from a CMS.  Not being able to select the style for html elements in the WYSIWYG editor severly effects the useabilty of OpenCMS from my point of view.  It means its quicker to get the code cut & paste to/from dreamweaver.  Which essentially makes the WYSIWYG editor redundant.

    Am I alone in thinking this?  what do other people that use CSS do?  

    regards

    James



      ----- Original Message ----- 
      From: BRAGA Bruno Gonçalves 
      To: James Adams ; The OpenCms mailing list 
      Sent: Monday, June 27, 2005 1:48 PM
      Subject: RES: [opencms-dev] xsd OpenCmsHtml editor 


      You can create templates with the HTML Gallery, and leave recorded several templates in HTML with css.

      But directly for the WYSIWYG I do not know if it is possible. One only was in the hand, right-hander in code HTML does not have wizard for css.



--------------------------------------------------------------------------

      De: James Adams [mailto:james at gamepub.com] 
      Enviada em: segunda-feira, 27 de junho de 2005 09:24
      Para: The OpenCms mailing list
      Assunto: Re: [opencms-dev] xsd OpenCmsHtml editor 


      Thanks Bruno for pointing me in the right direction.


      Do you know though if there is an option to apply styles to html elements ?  I had a look but couldn't immediately find anything.

      The WYSIWYG editor is fairly useless to me without this option.


      regards


      James



        ----- Original Message ----- 

        From: BRAGA Bruno Gonçalves 

        To: James Adams ; The OpenCms mailing list 

        Sent: Wednesday, June 22, 2005 2:15 PM

        Subject: RES: [opencms-dev] xsd OpenCmsHtml editor 


        I believe that this is not customize because he is fixed in the code (js). But you can edit it:


                    /system/workplace/resources/components/widgets/htmlarea.js


        config.toolbar = [

                                [

                                           "copy", "cut", "paste", "separator",

                                           "bold", "italic", "underline", "separator",

                                           "strikethrough", "subscript", "superscript", "separator",

                                           "insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",

                                           "htmlmode"

                                ]

                    ];



                    These words between quotations marks are them to toolbar itens that they go to appear in the html editor.


                    You can register new to be used. Look config.registerButton() function.

                    

                    It sees the code of the full html editor, to understand better.         



        Bruno Braga



------------------------------------------------------------------------

        De: James Adams [mailto:james at gamepub.com] 
        Enviada em: quarta-feira, 22 de junho de 2005 08:11
        Para: The OpenCms mailing list
        Assunto: Re: [opencms-dev] xsd OpenCmsHtml editor 


        Is it really not possible to have the full HTML editor options available when editing an element of type OpenCmsHtml in a XMLContent object?


        thanks in advance


        James

          ----- Original Message ----- 

          From: James Adams 

          To: opencms-dev at opencms.org 

          Sent: Wednesday, June 22, 2005 7:42 AM

          Subject: [opencms-dev] xsd OpenCmsHtml editor 


          Hello,


          I have an XMLContent type with a number of elements


          In the .xsd file the element MainText is of type OpenCmsHtml.  When adding elements there is a rich text editor for this element but it does not have the options for adding images and links as with the full html editor.  Can I enable this?


          .xsd file below


          regards


          James






          <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
           
           <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/> 
           <xsd:element name="Developments" type="OpenCmsDevelopments"/>
           
           <xsd:complexType name="OpenCmsDevelopments">
            <xsd:sequence>
             <xsd:element name="Development" type="OpenCmsDevelopment" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
           </xsd:complexType>


           <xsd:complexType name="OpenCmsDevelopment">
            <xsd:sequence>
             <xsd:element name="Headline" type="OpenCmsString" />
                                  <xsd:element name="MainText" type="OpenCmsHtml" />
                                  <xsd:element name="ImageUrl" type="OpenCmsString" />
                                  <xsd:element name="Links" type="OpenCmsString" minOccurs="0" maxOccurs="5"/>
                                  <xsd:element name="Email" type="OpenCmsString" />
             <xsd:element name="Reference" type="OpenCmsString" />   
             <xsd:element name="Telephone" type="OpenCmsString" />
                                  <xsd:element name="LOOP" type="OpenCmsString" />
                                  <xsd:element name="Fax" type="OpenCmsString" />
                                  <xsd:element name="IsAlive" type="OpenCmsString" />
            </xsd:sequence>
            <xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
           </xsd:complexType>
                  <xsd:annotation>
            <xsd:appinfo>
                                  <defaults>
              <default element="LOOP" value="NULL|WAFRINET|SAFRINET|PACINET|NAFRINET|EuroLOOP|ASEANET|ANDINONET|CARINET|EAFRINET|EASINET|PACINET|LATINET|MESOAMERINET|NAMERILOOP|SACNET|bionet"/>
                                          <default element="IsAlive" value="true|false"/>
             </defaults>
             <layouts>
              <layout element="LOOP" widget="SelectorWidget" />
                                          <layout element="IsAlive" widget="SelectorWidget" />
             </layouts>
             <resourcebundle name="org.opencms.frontend.templateone.xmlcontentdemo.workplace"/>
             <mappings>
              <mapping element="Headline" mapto="property:Title" />
             </mappings>
            </xsd:appinfo>


           </xsd:annotation>
          </xsd:schema>



----------------------------------------------------------------------



          _______________________________________________
          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 


----------------------------------------------------------------------

          No virus found in this incoming message.
          Checked by AVG Anti-Virus.
          Version: 7.0.323 / Virus Database: 267.7.9/23 - Release Date: 20/06/2005


------------------------------------------------------------------------

        No virus found in this incoming message.
        Checked by AVG Anti-Virus.
        Version: 7.0.323 / Virus Database: 267.7.10/25 - Release Date: 21/06/2005



--------------------------------------------------------------------------
      No virus found in this incoming message.
      Checked by AVG Anti-Virus.
      Version: 7.0.323 / Virus Database: 267.8.2/29 - Release Date: 27/06/2005

----------------------------------------------------------------------------


_______________________________________________
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



------------------------------------------------------------------------------


  No virus found in this incoming message.
  Checked by AVG Anti-Virus.
  Version: 7.0.323 / Virus Database: 267.8.2/29 - Release Date: 27/06/2005
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050629/2ded18f3/attachment.htm>


More information about the opencms-dev mailing list