NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Robert Iliuta on October 08, 2010, 04:56:31 AM

Title: Any way to implement a HTML editor?
Post by: Robert Iliuta on October 08, 2010, 04:56:31 AM
Hallo ,

I would like to implement a HTML editor in a form. IAny one implement an html editor? and like to share some tips...


Thank you,
Robert
Title: Re: Any way to implement a HTML editor?
Post by: Bruce on October 09, 2010, 08:10:36 AM
WebServer procedure, NetTalk extension, Scripts tab, turn on HTML editor.
The on the form, use a TEXT form-field-type and turn "allow xhtml" on.

cheers
Bruce
Title: Re: Any way to implement a HTML editor?
Post by: Robert Iliuta on October 10, 2010, 05:03:32 AM
Thnaks Bruce,

It works now. Is there a way to customize the buttons? Hide/Unhide ?I would like to make like in capesoft forum when you enter a topic.

Robert
Title: Re: Any way to implement a HTML editor?
Post by: Mike Grigsby on October 10, 2010, 08:57:12 PM
Robert, I recommend you use the Firebug analyzer/debugger for Firefox to see where the script and graphics are located. It makes customizing the CSS and .js files easier. The modifications you are talking about are usually not in NTWS, but the javascript that the template points to.
Title: Re: Any way to implement a HTML editor?
Post by: Bruce on October 12, 2010, 09:34:22 AM
Hi Robert,

There are a couple ways to customise the toolbar - the approach I used in the forums software was to override the TinyMCE Init method in the WebHandler. This is good, but of course then applies to all the txt boxes in the app - which may, or may not, be what you want.

So the key is the script that generates the init script for TinyMce. By overriding the method in WebHandler, and NOT calling the parent, you can initialise it any way you like. Here's the code from the web forums;

p_web._TinyMceInit PROCEDURE(String p_FieldId,Long p_Flags=0,<string p_manual>)

ReturnValue          ANY

! Start of "NetTalk Method Data Section"
! [Priority 5000]

! End of "NetTalk Method Data Section"

  CODE
  ! Start of "NetTalk Method Executable Code Section"
! [Priority 2500]
  ! my embed code starts here, the bit above is generated...
  ReturnValue = '<script language="javascript" type="text/javascript">tinyMCE.init({{ '&|
                'mode : "exact",elements : "'&self._nocolon(p_FieldId)&'",'
  case p_flags
  of 0
    ReturnValue = ReturnValue & |
      'theme_advanced_toolbar_location : "top",' &|
      'theme_advanced_toolbar_align : "left",' &|
      'theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,undo,redo,link,unlink,zoom,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,separator,numlist,bullist",' &|
      'theme_advanced_buttons2 : "fontselect,fontsizeselect,bold,italic,underline,strikethrough,forecolor,backcolor",' &|
      'theme_advanced_buttons3 : "",'

!      'plugins : "table,save,advhr,advimage,advlink,emotions,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,spellchecker",' &|
!      'theme_advanced_buttons1 : "newdocument,save,search,replace,print,preview,spellchecker,separator,cut,copy,paste,pastetext,pasteword,undo,redo,link,unlink,zoom,separator,tablecontrols",' &|
!      'theme_advanced_buttons2 : "styleselect,fontselect,fontsizeselect,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,numlist,bullist,outdent,indent,forecolor,backcolor",' &|
!      'theme_advanced_buttons3 : "insertdate,inserttime,emotions,media,flash,advhr,ltr,rtl,fullscreen",' &|
  End
  If not omitted(4)
    ReturnValue = ReturnValue & clip(p_manual)
  End
  ReturnValue = ReturnValue & 'theme : "advanced", entity_encoding : "raw"' &|
                '});</script>'
  Return(clip(returnValue))

! after this is more generated code including the parent call.

Hope this helps

Cheers
Bruce


Title: Re: Any way to implement a HTML editor?
Post by: Robert Iliuta on October 13, 2010, 12:01:25 AM
Hallo Bruce,

I just want to let you know that it works perfect!

Thank you very much for this tip.

Robert