Index: openacs-4/contrib/packages/irc-logger/ChangeLog =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/ChangeLog,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs-4/contrib/packages/irc-logger/ChangeLog 30 Jan 2003 02:48:43 -0000 1.1.1.1 +++ openacs-4/contrib/packages/irc-logger/ChangeLog 11 Feb 2003 21:36:14 -0000 1.1.1.2 @@ -1,5 +1,38 @@ -2003-01-29 Bart Teeuwisse <bart.teeuwisse@7-sisters.com> +2003-02-11 Bart Teeuwisse <bart.teeuwisse@thecodemill.biz> - * irc-logger.info (Module): Initial revision - (Module): Bumped up revision to 1.0b (beta) + * www/admin/index.adp (Module): + - Added update all RDF logs. +2003-02-10 Bart Teeuwisse <bart.teeuwisse@thecodemill.biz> + + * www/admin (Module): + - Removed all namespace references from the resulting HTML. This previously caused a problem for Opera (7). + - Added an update feature to the admin page. + - Removed an extraneous .xql file from /www/admin. + +2003-02-09 Bart Teeuwisse <bart.teeuwisse@thecodemill.biz> + + * data/default.xsl (Module): + - Break the description of long hyper links in chunks of 50 characters as not to interfere with the page layout. + - Flush the ETP page whenever the log is updated so that the displayed ETP page is always current. + +2003-01-31 Bart Teeuwisse <bart.teeuwisse@thecodemill.biz> + + * www/doc/index.adp (Module): + - Fixed link to daemontools + +2003-01-30 Bart Teeuwisse <bart.teeuwisse@thecodemill.biz> + + * tcl (Module): + - Shortened the timestamps to allow more space for the conversation. + - Added links to the user accounts who's screen name matches their IRC nick. + - Updated documentation to reflect new features. + - Removed <pre> tags from XSL sheet as they misfired too often. + + +2003-01-29 Bart Teeuwisse <bart.teeuwisse@thecodemill.biz> + + * irc-logger.info (Module): + - Initial revision + - Bumped up revision to 1.0b (beta) + Index: openacs-4/contrib/packages/irc-logger/irc-logger.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/irc-logger.info,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs-4/contrib/packages/irc-logger/irc-logger.info 30 Jan 2003 02:48:43 -0000 1.1.1.1 +++ openacs-4/contrib/packages/irc-logger/irc-logger.info 11 Feb 2003 21:36:15 -0000 1.1.1.2 @@ -7,19 +7,21 @@ <initial-install-p>f</initial-install-p> <singleton-p>f</singleton-p> - <version name="1.0b" url="http://openacs.org/repository/download/apm/irc-logger-1.0b.apm"> + <version name="1.0" url="http://openacs.org/repository/download/apm/irc-logger-1.0.apm"> <database-support> <database>oracle</database> <database>postgresql</database> </database-support> <owner url="mailto:bart.teeuwisse@thecodemill.biz">Bart Teeuwisse</owner> <summary>The IRC logger places the log files of logger (a Perl script by Dave Beckett) into ETP for integration with OpenACS.</summary> + <release-date>2003-02-10</release-date> <vendor url="http://www.thecodemill.biz">the Code Mill</vendor> <description format="text/html">The IRC logger places the log files of <a href="http://cvs.ilrt.org/cvsweb/redland/logger/">logger</a> (a Perl script by Dave Beckett) into ETP for integration with OpenACS. Besides logger, this package also depends on <a href="http://www.tdom.org/">tDOM</a> (high performance XML data processing with easy and powerful Tcl scripting functionality).</description> <!-- No dependency information --> <files> + <file path="ChangeLog"/> <file path="data/default.xsl"/> <file type="package_spec" path="irc-logger.info"/> <file path="perl/logger"/> @@ -28,10 +30,10 @@ <file type="query_file" db_type="postgresql" path="tcl/irc-logger-procs-postgresql.xql"/> <file type="tcl_procs" path="tcl/irc-logger-procs.tcl"/> <file type="query_file" path="tcl/irc-logger-procs.xql"/> - <file type="query_file" db_type="postgresql" path="www/admin/index-postgresql.xql"/> <file type="content_page" path="www/admin/index.adp"/> <file type="content_page" path="www/admin/index.tcl"/> <file type="query_file" path="www/admin/index.xql"/> + <file type="content_page" path="www/admin/update.tcl"/> <file type="documentation" path="www/doc/index.adp"/> <file type="documentation" path="www/doc/index.css"/> <file type="documentation" path="www/doc/index.tcl"/> Index: openacs-4/contrib/packages/irc-logger/data/default.xsl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/data/default.xsl,v diff -u -r1.1 -r1.1.1.1 --- openacs-4/contrib/packages/irc-logger/data/default.xsl 31 Jan 2003 06:51:09 -0000 1.1 +++ openacs-4/contrib/packages/irc-logger/data/default.xsl 11 Feb 2003 21:36:15 -0000 1.1.1.1 @@ -1,17 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns="http://www.w3.org/TR/xhtml1/strict" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wn="http://xmlns.com/wordnet/1.6/" xmlns:foaf="http://xmlns.com/foaf/0.1/" - xmlns:irc="irc::logger"> + xmlns:irc="irc::logger" + exclude-result-prefixes="xsl rdf dc wn foaf irc"> + <!-- Process each ChatChannel in the RDF file --> <xsl:template match="foaf:ChatChannel"> <xsl:apply-templates/> </xsl:template> + <!-- Create table per ChatChannel listing the events --> <xsl:template match="foaf:chatEventList"> <table> <tbody> @@ -20,6 +22,7 @@ </table> </xsl:template> + <!-- One event per table row, listing date/time, nick and event description. --> <xsl:template match="foaf:chatEvent"> <tr> <td nowrap="true" valign="top"> @@ -32,11 +35,16 @@ </tr> </xsl:template> + <!-- Display the time only but with the full date/time in the + title. The title pops up in tooltip when the mouse pointer + rests on the time. --> <xsl:template match="dc:date"> <xsl:variable name="formatted_date"><xsl:value-of select="translate(.,'TZ',' ')"/> GMT</xsl:variable> <font size="-1" color="grey" title="{$formatted_date}">[<xsl:value-of select="substring-before(substring-after(.,'T'), 'Z')"/>]</font> </xsl:template> + <!-- List the nick with a link to the OpenACS account if there is + an account with screen name 'nick'. --> <xsl:template match="dc:creator/wn:Person"> <td align="right" valign="top"> <font color="grey"><</font> @@ -45,31 +53,74 @@ </td> </xsl:template> + <!-- Parse the description --> <xsl:template match="dc:description"> <td valign="top"> <xsl:choose> + + <!-- Display users joining/leaving less prominent --> <xsl:when test="contains(.,'has joined #openacs') or contains(.,'has left #openacs')"> <font color="grey"><xsl:value-of select="."/></font> </xsl:when> + + <!-- Make http: links active hyperlinks --> <xsl:when test="contains(.,'http:')"> <xsl:if test="contains(substring-after(.,'http:'),' ')"> <xsl:value-of select="substring-before(.,'http:')"/> - <a href="http:{substring-before(substring-after(.,'http:'),' ')}">http:<xsl:value-of select="substring-before(substring-after(.,'http:'),' ')"/></a> + <a href="http:{substring-before(substring-after(.,'http:'),' ')}">http:<xsl:call-template name="split_string"> + <xsl:with-param name="string" select="substring-before(substring-after(.,'http:'),' ')"/> + </xsl:call-template> + </a> <xsl:value-of select="concat(' ',substring-after(substring-after(.,'http:'),' '))"/> </xsl:if> <xsl:if test="not(contains(substring-after(.,'http:'),' '))"> <xsl:value-of select="substring-before(.,'http:')"/> - <a href="http:{substring-after(.,'http:')}">http:<xsl:value-of select="substring-after(.,'http:')"/></a> + <a href="http:{substring-after(.,'http:')}">http:<xsl:call-template name="split_string"> + <xsl:with-param name="string" select="substring-after(.,'http:')"/> + </xsl:call-template> + </a> </xsl:if> </xsl:when> + + <!-- Display /me ... actions in a different style --> <xsl:when test="starts-with(.,'*')"> <i><xsl:value-of select="substring-after(.,'* ')"/></i> </xsl:when> + + <!-- For other events just copy the description from the log --> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </td> </xsl:template> + <!-- Insert spaces in long strings (e.g. href) so that they wrap and + no longer mess with the page layout. One space after each 50 + characters.--> + <xsl:template name="split_string"> + <xsl:param name="string"></xsl:param> + <xsl:param name="return"></xsl:param> + <xsl:variable name="max_length" select="50"/> + + <xsl:choose> + <xsl:when test="string-length($string) != 0"> + <xsl:choose> + <xsl:when test="string-length($string) > $max_length"> + <xsl:call-template name="split_string"> + <xsl:with-param name="string" select="substring($string, $max_length)"/> + <xsl:with-param name="return" select="concat($return, substring($string, 1, $max_length), ' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return, $string)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + </xsl:stylesheet> Index: openacs-4/contrib/packages/irc-logger/tcl/irc-logger-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/tcl/irc-logger-procs-postgresql.xql,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs-4/contrib/packages/irc-logger/tcl/irc-logger-procs-postgresql.xql 30 Jan 2003 02:48:48 -0000 1.1.1.1 +++ openacs-4/contrib/packages/irc-logger/tcl/irc-logger-procs-postgresql.xql 11 Feb 2003 21:36:20 -0000 1.1.1.2 @@ -11,4 +11,15 @@ select etp__create_page(:parent_package_id, :date, :date, :content_type) </querytext> </fullquery> + + <fullquery name="dom::xpathFunc::irc::logger::user_link.get_user"> + <querytext> + select u.user_id, p.first_names || ' ' || p.last_name as name + from users u, persons p + where u.screen_name = :nick + and p.person_id = u.user_id + limit 1 + </querytext> + </fullquery> + </queryset> Index: openacs-4/contrib/packages/irc-logger/tcl/irc-logger-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/tcl/irc-logger-procs.tcl,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs-4/contrib/packages/irc-logger/tcl/irc-logger-procs.tcl 30 Jan 2003 02:48:48 -0000 1.1.1.1 +++ openacs-4/contrib/packages/irc-logger/tcl/irc-logger-procs.tcl 11 Feb 2003 21:36:21 -0000 1.1.1.2 @@ -169,11 +169,11 @@ -package_id $package_id \ -default ""]" set log_latest_revision_id [etp::get_latest_revision_id $parent_package_id $date] + set content_type [etp::get_content_type] if {[empty_string_p $log_latest_revision_id]} { # Create a new ETP page for the log. - set content_type [etp::get_content_type] db_exec_plsql page_create {} } @@ -182,6 +182,10 @@ set log_live_revision_id [etp::get_live_revision_id $parent_package_id $date] set log_description "Conversation log of $irc_channel_name of $date" db_dml update_revision {} + + # Flush the cached page from memory + + util_memoize_flush "etp::get_pa $parent_package_id $date $content_type" } } } @@ -218,3 +222,111 @@ -date $gmt_today \ -package_id $package_id } + +namespace eval dom::xpathFunc::irc::logger { + + # The namespace of the tDOM XSLT extension functions for the + # irc-logger module. + +} + +ad_proc -public dom::xpathFunc::irc::logger::user_link { + ctxNode + pos + nodeListType + nodeList + args +} { + + <p>Create a link to the user account on this site where the IRC + nick matches the user's screen name.</p> + + <p>Rolf (rolf@pointsman.de) from the tDOM team on tDOM extension + functions:</p> + + <blockquote> + <p>If an XPath expr (both for the selectNodes method and in XSLT + stylesheets) uses a not standard XPath function name (you cannot + 'overwrite' the C coded standard built-in functions), the engine + looks, if there is a tcl proc with the given function name in + the ::dom::xpathFunc:: namespace. In other words: all extension + functions procs must reside in the namespace ::dom::xpathFunc or + in a child namespace of that namespace. If the XPath extension + function has a prefix, the prefix is expanded to the namespace + URI and that namespace URI must be the name of the child + namespace of the ::dom::xpathFunc namespace.</p> + + <p>If there is such a proc, this proc is called with the following + arguments: ctxNode pos nodeListType nodeList args. The 'args' + are, as type/value pairs, the arguments, that are given to the + extension functions. (E.g. if you have + myExtensionFunction('foo'), you will get two args, the first + "string" the second "foo").</p> + + <p>The tcl proc, which implements the extension function must + return a list of two elements: {<type> <value>}. The possible + types at the moment are: "bool", "number", "string", "nodes".</p> + + <p>But don't get confused by my probably (too) vague + explanations. Just look at the examples in the xpath.test and + tdom.tcl files. For almost all 'real life' needs, you should get + it very fast, what to do from that usage examples.</p> + </blockquote> + + @author Bart Teeuwisse (bart.teeuwisse@thecodemill.biz) + @creation-date 2003-01-31 + + @param ctxNode See <a href="http://www.tdom.org">tDOM</a> documentation. + @param pos See <a href="http://www.tdom.org">tDOM</a> documentation. + @param nodeListType See <a href="http://www.tdom.org">tDOM</a> documentation. + @param nodeList See <a href="http://www.tdom.org">tDOM</a> documentation. + + @param args A single (type, value) pair of type 'attrnodes' with + the nick of the IRC user. + + @return A single (type, value) pair with a link to the user + account on the site. Or just the nick if no user account was found. + + @error The empty string. + +} { + + # Default return value + + set link "" + + # Limited parameter checking. The tDOM related parameters don't + # matter. + + if {[llength $args] == 2} { + + # Get argument type and value. + + foreach {type value} $args { + break + } + + # Check that the parameter an attribute node is and extract + # the value of the attribute. + + if {[string equal $type "attrnodes"]} { + set nick [lindex [lindex $value end] end] + + # Locate the first user with a screen name of 'nick' on this + # site. DB caching reduces the number of hits on the DB + # itself. + + if {[db_0or1row get_user {}]} { + set link "<a href=\"[acs_community_member_url -user_id $user_id]\" title=\"$name\">$nick</a>" + } else { + set link $nick + } + } else { + ns_log warning "dom::xpathFunc::irc::logger::user_link wrong parameter type '$type($value)'; type should have been attrnodes" + } + } else { + ns_log warning "dom::xpathFunc::irc::logger::user_link accepts only 1 parameter, received [llength $args] parameters" + } + + return [list string $link] +} Index: openacs-4/contrib/packages/irc-logger/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/www/admin/index.adp,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs-4/contrib/packages/irc-logger/www/admin/index.adp 30 Jan 2003 02:48:49 -0000 1.1.1.1 +++ openacs-4/contrib/packages/irc-logger/www/admin/index.adp 11 Feb 2003 21:36:21 -0000 1.1.1.2 @@ -9,4 +9,46 @@ </tbody> </table> + <h4>Parameters</h4> + <p><a href="/admin/site-map/parameter-set?package_id=@package_id@">Set package parameters</a></p> + + <h4>RDF log files</h4> + + <p>The following RDF log files are available in the RDF + directory (<code>@rdf_dir@</code>).</p> + <p>Use <i>View</i> to visit the current ETP page of the log. Follow the <i>Update</i> link to re-apply + the XSL transformation to the RDF log(s).</p> + + <p>The log has no Update link if the RDF log is not writable by the + owner of this AOLserver process.</p> + + <table> + <tbody> + <multiple name="rdf_logs"> + <tr> + <td> + <ul> + <li>@rdf_logs.desc@</li> + </ul> + </td> + <td>[ + <if @rdf_logs.view_href@ not nil> + <a href="@rdf_logs.view_href@" title="View the current ETP page of the log">View</a> + <if @rdf_logs.update_href@ not nil> + | + </if> + </if> + <if @rdf_logs.update_href@ not nil> + <a href="@rdf_logs.update_href@" title="Re-apply the XSL transformation to the RDF log(s)">Update</a> + </if>] + </td> + <td> + <if @updated@ eq @rdf_logs.date@> + <font color="green"><i>Updated</i></font> + </if> + </td> + </tr> + </multiple> + </tbody> + </table> Index: openacs-4/contrib/packages/irc-logger/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/www/admin/index.tcl,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs-4/contrib/packages/irc-logger/www/admin/index.tcl 30 Jan 2003 02:48:49 -0000 1.1.1.1 +++ openacs-4/contrib/packages/irc-logger/www/admin/index.tcl 11 Feb 2003 21:36:21 -0000 1.1.1.2 @@ -7,9 +7,11 @@ @creation-date 2003-01-29 @cvs $Id$ } { + {updated {}} } -properties { title:onevalue - + rdf_dir:onevalue + rdf_logs:multilist } # Authenticate the user @@ -34,3 +36,26 @@ } else { set title "Administration" } + +# Create a data source of remaining RDF log files in the log directory + +multirow create rdf_logs desc date view_href update_href +set rdf_dir [parameter::get \ + -parameter irc_rdf_dir \ + -package_id $package_id \ + -default ""] + +# First a link to update all RDF log files. + +multirow append rdf_logs "All RDF log files" "*" {} update?[export_vars -url {{date *}}] + +# Followed by links to individual RDF log files. + +foreach rdf_log [glob -nocomplain -directory $rdf_dir *.rdf] { + set date [file rootname [file tail $rdf_log]] + if {[file writable $rdf_log]} { + multirow append rdf_logs $date $date ../../$date update?[export_vars -url {date $date}] + } else { + multirow append rdf_logs $date $date ../../$date {} + } +} Index: openacs-4/contrib/packages/irc-logger/www/doc/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/www/doc/index.adp,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs-4/contrib/packages/irc-logger/www/doc/index.adp 30 Jan 2003 02:48:49 -0000 1.1.1.1 +++ openacs-4/contrib/packages/irc-logger/www/doc/index.adp 11 Feb 2003 21:36:22 -0000 1.1.1.2 @@ -70,7 +70,7 @@ </code></pre></blockquote> <p>Place logger under supervision using <a - href=="http://cr.yp.to/daemontools.html">daemontools</a> or crontab + href="http://cr.yp.to/daemontools.html">daemontools</a> or crontab to guarantee that the bot stays connected to the IRC channel it is logging.</p> @@ -142,8 +142,13 @@ Edit-This-Page page of the log directly under the instance of Edit-This-Page that @package_name@ is mounted under.</p> - <p>@package_name@ can be mounted more than once. Each instance processing the logs of a different bot.</p> + <p>@package_name@ can be mounted more than once. Each instance + processing the logs of a different bot.</p> + <p>@package_name@ will link to the user's profile and include the + full name for users of the site who have entered their IRC nick as + their OpenACS <a href="@pvt_home@">screen name</a>.</p> + <h2>Credits</h2> <p>The @package_name@ was designed and written by <a Index: openacs-4/contrib/packages/irc-logger/www/doc/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/irc-logger/www/doc/index.tcl,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs-4/contrib/packages/irc-logger/www/doc/index.tcl 30 Jan 2003 02:48:49 -0000 1.1.1.1 +++ openacs-4/contrib/packages/irc-logger/www/doc/index.tcl 11 Feb 2003 21:36:22 -0000 1.1.1.2 @@ -21,6 +21,8 @@ set context_bar [ad_context_bar $package_name] +set pvt_home [ad_pvt_home] + # Set signatory for at the bottom of the page set signatory "bart.teeuwisse@thecodemill.biz"