Search · Index


Filtered by popular tag javascript, 1 - 2 of 2 Postings (all, summary)

Body Onload javascript event

Created by Rocael Hernández Rizzardini, last modified by Gustaf Neumann 22 Oct 2016, at 09:10 AM

API calls for adding javascript



add event listener for a single ID or for a CSS class. When using this call, the provided JavaScript snipped will be added suitable for content security policies (by adding nonces ).


    template::add_event_listener \
        -id edit-tags-control \
        -script [subst {document.getElementById("edit_tags").style.display="block";}]


Adds javascript code to an event handler in the body tag. Several javascript code blocks may be assigned to each handler by subsequent calls to template::add_body_handler.


Add a script to the start of the body section of the document to be returned to the users client.



There was no easy way to add onload event to openacs, unless you edit www/site-master.tcl, but now you can define within you own package what functions you want to be for onload javascript event. This tcl callback definition will work for any page.

   ad_proc -public -callback subsite::header_onload -impl my_onload {} {
      return the function to load when the page is served
   } {
      return {my_javascript_function();}

Or in case you want it for a single page, or for you custom template, use the template property to send it:

   <property name="body(onload)">

Alternatively, as the on_load property tag has been deprecated, you could in your .tcl file set a variable

   set my_function_name "my_javascript_function();"

then in the .adp

   <property name="body(onload)">


Created by Emmanuelle Raffenne, last modified by Benjamin Brink 22 Oct 2016, at 02:59 AM

Package Specification Summary for Package: chat

Summary: Server based chat with an html and ajax client.
Description: Adapted by Peter Alberer 2006/03/25 to allow java and ajax to coexist. Adapted by Tekne 2006/03/01 to replace JAVA server with AJAX; make use of generalized chat class from xotcl-core.
Maturity: New Submission or Maturity Unknown
This package depends on: acs-kernel xotcl-core
Packages that depend on chat: chat-includelet chat-portlet dotlrn-chat
Package parameters:
Height of the applet (default 500, type number, scope instance)
width of the applet (default 700, type number, scope instance)
Default client interface to use (default ajax, type string, scope instance)
Chat server host (default , type string, scope instance)
Listening for chat connection on this port (default 8200, type number, scope instance)
A list of colors to assign to user names in the chat (default #006400 #0000ff #b8860b #bdb76b #8b0000, type string, scope instance)

Bug Tracker Summary for Package: chat

Open Bugs: 1
Latest Bug Opened: 2006-04-05 Ajax chat English language catalog incomplete
Latest Bug Fixed: 2015-07-25 Russian localization for package chat(HEAD).
Top Bug Submitters: Ryan Gallimore (3) Joel Aufrecht (1) v v (1)
Top Bug Fixers: Gustaf Neumann (4)

Code Metrics Summary for Package: chat

# Tcl Procs 30
# Tcl Lines 621
# Automated Tests 0
# Stored Procedures PG: 0 ORA: 0
# SQL Lines PG: 0 ORA: 0
# ADP pages 21
# ADP lines 445
# Include pages (chat/lib/) 3
# Documentation pages 0
# Documentation lines 0
Browse Source Not installed


The chat package is using currently two different chat engines:

  1. The Java applet and the Java chat server, or
  2. the Ajax based chat class from xotcl-core

If no xotcl-core is installed, one can only use the version with Java applet. If xotcl-core is installed, one has to option to choose between both engines via parameter.

In essence, the Ajax based variant is the chat implementation from xowiki plus chat room management and a list of the currently connected users. Originally, the ajax-based chat class (::xo::Chat) was developed for xowiki, but later moved to xotcl-core such that the chat package does not need a dependency on xotcl-core and xowiki.

Actually, the chat support in xowiki contains a different variety of ajax based communication strategies:

  1. Polling mode (the web browser queries via ajax in definable intervals the server, and checks, if there is some new information available), and
  2. Streaming mode (the client opens a connection to the server, the server pushes the information back to the client. xowiki chat supports two different submodes:
    1. streaming of JSON  objects via asynchronous AJAX sockets, or
    2. scripted streaming, where the browser loads HTML with embedded script tags in the background  from an hidden iframe

Both (2a) and (2b) require libthread support and a small patch for the aolserver, so they are currently not for beginners. However, the advantage of the streaming approaches is that they are much faster in the look and feel and that they are better scalable on sites with a high load. 2a works only on firefox (not in current versions of IE or Safari) and has the advantage over 2b that the browser does not show the background activity (no spinning wheel in Firefox). 2b is more robust and works with Safari, IE and Firefox (the information about the browser support is from 2006, and most probably different today). Both streaming modes implement, what is sometimes called COMET .


When the chat package uses the ::xo::Chat, it uses it only in currently only polling mode which has the  least requirements. This has been as well tested with (Firefox, IE and Safari).





previous December 2018
Sun Mon Tue Wed Thu Fri Sat
25 26 27 28 29 30 (1) 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

Popular tags

17 , 5.9.0 , 5.9.1 , ad_form , ADP , ajax , aolserver , asynchronous , bgdelivery , bootstrap , bugtracker , CentOS , COMET , compatibility , CSP , CSRF , cvs , debian , emacs , engineering-standards , fedora , FreeBSD , guidelines , host-node-map , hstore , includelets , install , installation , installers , install-ns
No registered users in community xowiki
in last 30 minutes