Index: openacs-4/packages/chat/chat.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/chat.info,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/chat/chat.info 24 Jun 2007 15:21:18 -0000 1.11
+++ openacs-4/packages/chat/chat.info 19 Nov 2007 01:14:08 -0000 1.12
@@ -7,21 +7,20 @@
f
f
-
+
Peter Alberer
Server based chat with an html and ajax client.
2006-04-11
OpenACS
- Adapted by Peter Alberer 2006/03/25 to allow java and ajax to coexist.
+ 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.
0
-
+
-
Index: openacs-4/packages/chat/catalog/chat.de_DE.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/catalog/chat.de_DE.ISO-8859-1.xml,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/chat/catalog/chat.de_DE.ISO-8859-1.xml 24 Jun 2006 14:23:40 -0000 1.2
+++ openacs-4/packages/chat/catalog/chat.de_DE.ISO-8859-1.xml 19 Nov 2007 01:14:15 -0000 1.3
@@ -92,7 +92,6 @@
Raumname
Raum nicht aktiv
Raum nicht gefunden
- R�ume
Senden
Sende Nachricht...
Es sind keine R�ume verf�gbar
Index: openacs-4/packages/chat/catalog/chat.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/catalog/chat.en_US.ISO-8859-1.xml,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/catalog/chat.en_US.ISO-8859-1.xml 21 Jun 2007 11:06:29 -0000 1.3
+++ openacs-4/packages/chat/catalog/chat.en_US.ISO-8859-1.xml 19 Nov 2007 01:14:15 -0000 1.4
@@ -94,10 +94,8 @@
Room name
Room no active
Room not found, Invalid room id
- rooms
Send/Refresh
Sending message...
- There are no messages to delete
There are no rooms available
to
Transcript
Index: openacs-4/packages/chat/catalog/chat.es_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/catalog/chat.es_ES.ISO-8859-1.xml,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/catalog/chat.es_ES.ISO-8859-1.xml 15 May 2007 20:14:23 -0000 1.3
+++ openacs-4/packages/chat/catalog/chat.es_ES.ISO-8859-1.xml 19 Nov 2007 01:14:15 -0000 1.4
@@ -94,7 +94,6 @@
Nombre de la sala
Sala no activa
Sala no encontrada. Id de sala incorrecto
- salas
Enviar/Actualizar
Enviando mensaje...
No hay salas disponibles
Index: openacs-4/packages/chat/catalog/chat.pt_BR.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/catalog/chat.pt_BR.ISO-8859-1.xml,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/catalog/chat.pt_BR.ISO-8859-1.xml 15 May 2007 20:14:23 -0000 1.3
+++ openacs-4/packages/chat/catalog/chat.pt_BR.ISO-8859-1.xml 19 Nov 2007 01:14:15 -0000 1.4
@@ -79,6 +79,7 @@
Moderada
Mensagem
Nome
+ N�o
Sem informa��es dispon�veis
Desativada
Atualizar
@@ -106,18 +107,22 @@
transcri��o de todas as mensgens do chat
Transcri��es
Transcri��es dispon�veis na sala
+ Transcri��o
+ Transcri��o
N�o autorizado
Privil�gio n�o autorizado
Desbanir
desbanir
Desbanir usu�rio
Sem T�tulo
Atualizar sala
+ Usu�rios permitidos
Usu�rios banidos
Ver
Ver transcri��o
para nome ou e-mail ou usu�rio limitado a
<b>Aviso</b> O par�emtro do pacote "DefaultClient" est� configurado para "Ajax" mas o pacote xotcl-core n�o est� instalado. Chat em Ajax n�o funciona sem o xotcl-core!
+ Sim
Voc� n�o tem permiss�o para entrar nesta sala de chat
seu nome �
Index: openacs-4/packages/chat/lib/current-messages.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/current-messages.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/lib/current-messages.tcl 7 Jun 2007 09:14:24 -0000 1.3
+++ openacs-4/packages/chat/lib/current-messages.tcl 19 Nov 2007 01:14:15 -0000 1.4
@@ -7,25 +7,7 @@
}
db_multirow -extend { person_name } messages select_msg_itens $sql {
- db_1row room_info2 {
- select count(r.alias)
- from chat_registered_users r
- where r.user_id = :creation_user
- and r.room_id = :room_id
+ if { [catch { set person_name [chat_user_name $creation_user] }] } {
+ set person_name "Unknown"
}
- if { $count > 0} {
- db_1row room_info2 {
- select r.alias
- from chat_registered_users r
- where r.user_id = :creation_user
- and r.room_id = :room_id
- }
- if { [catch { set person_name [chat_user_name2 $creation_user $alias] }] } {
- set person_name "System"
- }
- } else {
- if { [catch { set person_name [chat_user_name $creation_user] }] } {
- set person_name "System"
- }
- }
}
Index: openacs-4/packages/chat/lib/transcript-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/transcript-view.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/lib/transcript-view.tcl 7 Jun 2007 09:14:24 -0000 1.3
+++ openacs-4/packages/chat/lib/transcript-view.tcl 19 Nov 2007 01:14:15 -0000 1.4
@@ -8,21 +8,4 @@
where transcript_id=:transcript_id
}
-set user_id [ad_conn user_id]
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-set edit_p 1
-} else {
set edit_p [permission::permission_p -object_id $room_id -privilege "chat_transcript_edit"]
-}
Index: openacs-4/packages/chat/sql/postgresql/chat-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/sql/postgresql/chat-create.sql,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/chat/sql/postgresql/chat-create.sql 24 Jun 2007 15:21:19 -0000 1.6
+++ openacs-4/packages/chat/sql/postgresql/chat-create.sql 19 Nov 2007 01:14:15 -0000 1.7
@@ -1,7 +1,9 @@
--
-- packages/chat/sql/chat-create.sql
--
--- @author ddao@arsdigita.com and Pablo Mu�oz(pablomp@tid.es)
+-- @author ddao@arsdigita.com
+-- @creation-date November 09, 2000
+-- @cvs-id $Id$
--
@@ -84,8 +86,6 @@
);
-
-
attr_id := acs_attribute__create_attribute (
''chat_room'', -- object_type
''pretty_name'', -- attribute_name
@@ -180,8 +180,37 @@
SELECT inline_0();
DROP function inline_0();
----------------------------------------
+create table chat_rooms (
+
+ room_id integer
+ constraint chat_rooms_room_id_pk primary key
+ constraint chat_rooms_room_id_fk
+ references acs_objects(object_id),
+ -- This is room name.
+ pretty_name varchar(100)
+ constraint chat_rooms_pretty_name_nn not null,
+ description varchar(2000),
+ moderated_p boolean
+ default 'f'
+ constraint chat_rooms_moderate_p_ck
+ check (moderated_p in ('t','f')),
+ active_p boolean
+ default 't'
+ constraint chat_rooms_active_p_ck
+ check (active_p in ('t','f')),
+ -- if set then log all chat messages in this room.
+ archive_p boolean
+ default 't'
+ constraint chat_rooms_archive_p_ck
+ check (archive_p in ('t', 'f')),
+ -- flush the rooms messages every night at 00:05
+ auto_flush_p boolean default 't',
+ -- automatically create a transcript after flushing the room
+ auto_transcript_p boolean default 'f'
+);
+
+
-- create chat transcript object type
CREATE FUNCTION inline_0()
RETURNS integer
@@ -265,299 +294,115 @@
DROP function inline_0();
----------------------------------------------
-
-CREATE TABLE chat_rooms (
- room_id INTEGER NOT NULL,
- pretty_name VARCHAR(100) NOT NULL,
- description VARCHAR(2000),
- moderated_p BOOLEAN DEFAULT false,
- active_p BOOLEAN DEFAULT true,
- archive_p BOOLEAN DEFAULT false,
- maximal_participants INTEGER,
- end_date DATE,
- creator INTEGER,
- context_id INTEGER,
- comm_name VARCHAR,
- open BOOLEAN,
- auto_transcript_p BOOLEAN,
- file_sent BOOLEAN,
- private BOOLEAN,
- frequency1 VARCHAR,
- CONSTRAINT chat_rooms_room_id_pk PRIMARY KEY(room_id),
- CONSTRAINT chat_rooms_active_p_ck CHECK ((active_p = true) OR (active_p = false)),
- CONSTRAINT chat_rooms_archive_p_ck CHECK ((archive_p = true) OR (archive_p = false)),
- CONSTRAINT chat_rooms_moderate_p_ck CHECK ((moderated_p = true) OR (moderated_p = false)),
- CONSTRAINT chat_rooms_fk FOREIGN KEY ("creator")
- REFERENCES users(user_id)
- ON DELETE cascade
- NOT DEFERRABLE,
- CONSTRAINT chat_rooms_room_id_fk FOREIGN KEY (room_id)
- REFERENCES acs_objects(object_id)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
- NOT DEFERRABLE
-) WITH OIDS;
-
-
---------------------------------
-CREATE TABLE chat_transcripts (
- transcript_id INTEGER NOT NULL,
- contents VARCHAR(32000) NOT NULL,
- pretty_name VARCHAR(100) NOT NULL,
- description VARCHAR(2000),
- room_id INTEGER,
- date DATE,
- keywords VARCHAR,
- CONSTRAINT chat_trans_transcript_id_pk PRIMARY KEY(transcript_id),
- CONSTRAINT chat_trans_room_id_fk FOREIGN KEY (room_id)
- REFERENCES chat_rooms(room_id)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
- NOT DEFERRABLE,
- CONSTRAINT chat_trans_transcript_id_fk FOREIGN KEY (transcript_id)
- REFERENCES acs_objects(object_id)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
- NOT DEFERRABLE
-) WITH OIDS;
+create table chat_transcripts (
+ transcript_id integer
+ constraint chat_trans_transcript_id_pk primary key
+ constraint chat_trans_transcript_id_fk
+ references acs_objects(object_id),
+ contents varchar(32000)
+ constraint chat_trans_contents_nn not null,
+ -- Chat transcript name.
+ pretty_name varchar(100)
+ constraint chat_trans_pretty_name_nn not null,
+ description varchar(2000),
+ room_id integer
+ constraint chat_trans_room_id_fk references chat_rooms
+);
---------------------------------
-CREATE TABLE chat_msgs (
- msg_id INTEGER NOT NULL,
- msg VARCHAR(4000),
- msg_len INTEGER,
- html_p BOOLEAN DEFAULT false,
- approved_p BOOLEAN DEFAULT true,
- creation_user INTEGER NOT NULL,
- creation_ip VARCHAR(50),
- creation_date DATE NOT NULL,
- room_id INTEGER,
- CONSTRAINT chat_msgs_msg_id_pk PRIMARY KEY(msg_id),
- CONSTRAINT chat_msgs_approve_p_ck CHECK ((approved_p = true) OR (approved_p = false)),
- CONSTRAINT chat_msgs_html_p_ck CHECK ((html_p = true) OR (html_p = false)),
- CONSTRAINT chat_msgs_msg_len_ck CHECK (msg_len >= 0),
- CONSTRAINT chat_msgs_creation_user_fk FOREIGN KEY (creation_user)
- REFERENCES parties(party_id)
- ON DELETE cascade
- NOT DEFERRABLE,
- CONSTRAINT chat_msgs_room_id_fk FOREIGN KEY (room_id)
- REFERENCES chat_rooms(room_id)
- ON DELETE cascade
- NOT DEFERRABLE
-) WITH OIDS;
+create table chat_msgs (
+ msg_id integer
+ constraint chat_msgs_msg_id_pk primary key,
+ msg varchar(4000),
+ msg_len integer
+ constraint chat_msgs_msg_len_ck
+ check (msg_len >= 0),
+ html_p boolean
+ default 'f'
+ constraint chat_msgs_html_p_ck
+ check (html_p in ('t','f')),
+ approved_p boolean
+ default 't'
+ constraint chat_msgs_approve_p_ck
+ check(approved_p in ('t','f')),
+ creation_user integer
+ constraint chat_msgs_creation_user_fk
+ references parties(party_id)
+ constraint chat_msgs_creation_user_nn not null,
+ creation_ip varchar(50) ,
+ creation_date timestamptz,
+ room_id integer
+ constraint chat_msgs_room_id_fk references chat_rooms
+);
---------------------------------
-
-CREATE TABLE chat_registered_users (
- alias VARCHAR(20) NOT NULL,
- room_id INTEGER,
- user_id INTEGER,
- rss_service BOOLEAN,
- mail_service BOOLEAN,
- registered_id INTEGER NOT NULL,
- frequency_mail varchar,
- registered_date TIMESTAMP(0) WITHOUT TIME ZONE,
- CONSTRAINT chat_registered_users_pkey PRIMARY KEY(registered_id),
- CONSTRAINT chat_registered_users_fk FOREIGN KEY (room_id)
- REFERENCES chat_rooms(room_id)
- ON DELETE cascade
- NOT DEFERRABLE,
- CONSTRAINT chat_registered_users_fk1 FOREIGN KEY (user_id)
- REFERENCES users(user_id)
- ON DELETE cascade
- NOT DEFERRABLE,
- CONSTRAINT chat_registered_users_fk2 FOREIGN KEY (registered_id)
- REFERENCES acs_objects(object_id)
- ON DELETE cascade
- NOT DEFERRABLE
-) WITH OIDS;
-
-
---------------------------------
-CREATE TABLE chat_keywords (
- room_id INTEGER,
- keyword VARCHAR,
- CONSTRAINT chat_keywords_fk FOREIGN KEY (room_id)
- REFERENCES chat_rooms(room_id)
- ON DELETE cascade
- NOT DEFERRABLE
-) WITH OIDS;
+create or replace function chat_room__new (integer, varchar, varchar, boolean, boolean, boolean, boolean, boolean, integer, timestamptz, integer, varchar, varchar)
+returns integer as '
+declare
+ p_room_id alias for $1;
+ p_pretty_name alias for $2;
+ p_description alias for $3;
+ p_moderated_p alias for $4;
+ p_active_p alias for $5;
+ p_archive_p alias for $6;
+ p_auto_flush_p alias for $7;
+ p_auto_transcript_p alias for $8;
+ p_context_id alias for $9;
+ p_creation_date alias for $10;
+ p_creation_user alias for $11;
+ p_creation_ip alias for $12;
+ p_object_type alias for $13;
+ v_room_id chat_rooms.room_id%TYPE;
+begin
+ v_room_id := acs_object__new (
+ null,
+ ''chat_room'',
+ now(),
+ p_creation_user,
+ p_creation_ip,
+ p_context_id
+ );
+ insert into chat_rooms
+ (room_id, pretty_name, description, moderated_p, active_p, archive_p, auto_flush_p, auto_transcript_p)
+ values
+ (v_room_id, p_pretty_name, p_description, p_moderated_p, p_active_p, p_archive_p, p_auto_flush_p, p_auto_transcript_p);
----------------------------------
+return v_room_id;
-CREATE TABLE chat_private_room_users (
- room_id INTEGER,
- user_id1 INTEGER,
- user_id2 INTEGER,
- CONSTRAINT chat_private_room_users_fk FOREIGN KEY (room_id)
- REFERENCES chat_rooms(room_id)
- ON DELETE cascade
- NOT DEFERRABLE
-) WITH OIDS;
+end;' language 'plpgsql';
----------------------------------
-CREATE TABLE chat_room_user_id (
- room_id INTEGER NOT NULL references chat_rooms
- on delete cascade,
- user_id INTEGER NOT NULL,
- CONSTRAINT chat_room_user_id_fk FOREIGN KEY (user_id)
- REFERENCES users(user_id)
- ON DELETE cascade
- NOT DEFERRABLE
-) WITH OIDS;
---------------------------------
-
-CREATE TABLE chat_rooms_files_sent (
- file VARCHAR,
- title VARCHAR,
- room_id INTEGER NOT NULL,
- date DATE,
- send_file_id INTEGER references cr_revisions
- on delete cascade,
- description VARCHAR,
- message BOOLEAN,
- creation_user INTEGER,
- CONSTRAINT chat_rooms_files_sent_fk FOREIGN KEY (room_id)
- REFERENCES chat_rooms(room_id)
- ON DELETE cascade
- NOT DEFERRABLE
-) WITH OIDS;
-
-
----------------------------------
-
-
-CREATE TABLE chat_rss (
- room_name VARCHAR,
- creator VARCHAR,
- end_date DATE,
- description VARCHAR,
- comm_name VARCHAR,
- user_registered VARCHAR,
- rss_id INTEGER NOT NULL,
- date TIMESTAMP(0) WITHOUT TIME ZONE,
- entry_timestamp TIMESTAMP(0) WITHOUT TIME ZONE,
- CONSTRAINT "chat_rss_pkey" PRIMARY KEY("rss_id")
-) WITH OIDS;
-
-
----------------------------------
-
-CREATE TABLE chat_file_transcript (
- transcript_id INTEGER,
- file_id INTEGER
-) WITH OIDS;
-
----------------------------------
-
-CREATE TABLE chat_files_rss (
- file_id INTEGER,
- rss_id INTEGER
-) WITH OIDS;
-
-
----------------------------------
-
-CREATE TABLE chat_key_rss (
- rss_id INTEGER,
- key VARCHAR
-) WITH OIDS;
-
-
----------------------------------
-
-CREATE TABLE chat_partitipants_rss (
- partitipant VARCHAR,
- rss_id INTEGER
-) WITH OIDS;
-
-
----------------------------------
-
-CREATE TABLE chat_partitipants_transcript (
- transcript_id INTEGER,
- partitipant VARCHAR
-) WITH OIDS;
-
----------------------------------
-
-CREATE TABLE chat_room_transcript_keywords (
- keyword VARCHAR,
- transcript_id INTEGER
-) WITH OIDS;
-
-
----------------------------------
-
-CREATE TABLE chat_transcription_rss (
- rss_id INTEGER,
- transcription_id INTEGER
-) WITH OIDS;
-
-
----------------------------------
-
-CREATE OR REPLACE FUNCTION chat_room__new (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, varchar, integer, varchar, varchar, varchar, varchar) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
+create function chat_room__name (integer)
+returns varchar as '
declare
- p_pretty_name alias for $1;
- p_alias alias for $2;
- p_description alias for $3;
- p_key_words alias for $4;
- p_maxP alias for $5;
- p_end_date alias for $6;
- p_Rss_service alias for $7;
- p_Mail_service alias for $8;
- p_moderated_p alias for $9;
- p_active_p alias for $10;
- p_archive_p alias for $11;
- p_context_id alias for $12;
- p_comm_name alias for $13;
- p_creation_user alias for $14;
- p_creation_ip alias for $15;
- p_object_type alias for $16;
- p_frequency1 alias for $17;
- p_frequency2 alias for $18;
- v_room_id chat_rooms.room_id%TYPE;
- v_registered_id chat_rooms.room_id%TYPE;
- v_comm_name varchar;
+ p_room_id alias for $1;
+ v_pretty_name chat_rooms.pretty_name%TYPE;
begin
- v_room_id := acs_object__new(null,''chat_room'',now(),p_creation_user,p_creation_ip,p_context_id );
- v_registered_id := acs_object__new(null,''chat_room'',now(),p_creation_user,p_creation_ip,p_context_id );
+ select into v_pretty_name pretty_name from chat_rooms where room_id = p_room_id;
+ return v_pretty_name;
+end;' language 'plpgsql';
- insert into chat_rooms
- (room_id, pretty_name, description, moderated_p, active_p, archive_p, maximal_participants, end_date, creator, context_id,comm_name,auto_transcript_p,file_sent,private,frequency1)
- values
- (v_room_id, p_pretty_name, p_description, p_moderated_p, p_active_p, p_archive_p, p_maxP, p_end_date,p_creation_user, p_context_id,v_comm_name,''true'',''false'',''false'',p_frequency1);
- insert into chat_registered_users
- (alias, room_id, user_id, RSS_service, mail_service, registered_id, frequency_mail)
- values
- (p_alias, v_room_id, p_creation_user, p_Rss_service, p_Mail_service, v_registered_id, p_frequency2);
-return v_room_id;
+-------------------------------
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-
--------------------------------
-
-CREATE OR REPLACE FUNCTION chat_room__message_count (integer) RETURNS integer AS'
+create function chat_room__message_count (integer)
+returns integer as '
declare
p_room_id alias for $1;
v_count integer;
@@ -567,108 +412,54 @@
where room_id = p_room_id;
return v_count;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
+end;' language 'plpgsql';
---------------------------------
-CREATE OR REPLACE FUNCTION chat_room__delete_all_msgs (integer) RETURNS integer AS'
+
+
+create function chat_room__delete_all_msgs (integer)
+returns integer as '
declare
p_room_id alias for $1;
begin
delete from chat_msgs where room_id = p_room_id;
return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
+end;' language 'plpgsql';
---------------------------------
-CREATE OR REPLACE FUNCTION chat_room__del (integer) RETURNS integer AS'
+
+create function chat_room__del (integer)
+returns integer as '
declare
p_room_id alias for $1;
begin
--TO DO: delete transcriptions?
- -- Erase all the users relate to this chat room.
- delete from chat_private_room_users where room_id = p_room_id;
-
- -- Erase all the files sent relate to this chat room.
- delete from chat_rooms_files_sent where room_id = p_room_id;
- -- Erase all the messages relate to this chat room.
+ -- First erase all the messages relate to this chat room.
delete from chat_msgs where room_id = p_room_id;
- -- Erase all the registered users relate to this chat room.
- delete from chat_registered_users where room_id = p_room_id;
-
- -- Erase all the transcripts relate to this chat room.
- delete from chat_transcripts where room_id = p_room_id;
-
- -- Erase all the keywords to this chat room.
- delete from chat_keywords where room_id = p_room_id;
-
-- Delete all privileges associate with this room
delete from acs_permissions where object_id = p_room_id;
-- Now delete the chat room itself.
delete from chat_rooms where room_id = p_room_id;
-
- delete from rss_gen_subscrs where summary_context_id = p_room_id;
-
- delete from acs_objects where context_id = p_room_id;
PERFORM acs_object__delete(p_room_id);
return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
+end;' language 'plpgsql';
----------------------------------
-CREATE OR REPLACE FUNCTION chat_room__delete_registered_users (integer, integer) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
- p_room_id alias for $1;
- p_user_id alias for $2;
-begin
- delete from chat_registered_users where room_id = p_room_id
- and user_id = p_user_id;
- return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-
-
-
---------------------------------
-CREATE OR REPLACE FUNCTION chat_room_registered__user (varchar, integer, integer, boolean, boolean, integer, varchar, varchar) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
- p_alias alias for $1;
- p_user_id alias for $2;
- p_room_id alias for $3;
- p_RSS_service alias for $4;
- p_mail_service alias for $5;
- p_context_id alias for $6;
- p_creation_ip alias for $7;
- p_frequency_mail alias for $8;
- v_registered_id chat_rooms.room_id%TYPE;
-begin
- v_registered_id := acs_object__new(null,''chat_room'',now(),p_user_id,p_creation_ip,p_context_id );
- insert into chat_registered_users
- (alias, room_id, user_id, RSS_service, mail_service, registered_id, frequency_mail, registered_date)
- values
- (p_alias, p_room_id, p_user_id, p_RSS_service, p_mail_service, v_registered_id, p_frequency_mail, now());
-return v_registered_id;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
----------------------------------
-
-
-CREATE OR REPLACE FUNCTION chat_transcript__new (varchar, varchar, varchar, integer, integer, timestamptz, integer, varchar, varchar) RETURNS integer AS'
+create function chat_transcript__new (varchar, varchar, varchar, integer, integer, timestamptz, integer, varchar, varchar)
+returns integer as '
declare
p_pretty_name alias for $1;
@@ -691,19 +482,17 @@
p_context_id
);
- insert into chat_transcripts (transcript_id, pretty_name, contents, description, room_id, date)
- values (v_transcript_id, p_pretty_name, p_contents, p_description, p_room_id, now());
+ insert into chat_transcripts (transcript_id, pretty_name, contents, description, room_id)
+ values (v_transcript_id, p_pretty_name, p_contents, p_description, p_room_id);
return v_transcript_id;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
+end;' language 'plpgsql';
-----------------------------
-
-
-CREATE OR REPLACE FUNCTION chat_transcript__del (integer) RETURNS integer AS'
+create function chat_transcript__del (integer)
+returns integer as '
declare
p_transcript_id alias for $1;
begin
@@ -716,61 +505,41 @@
PERFORM acs_object__delete(p_transcript_id);
return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-
-
+end;' language 'plpgsql';
----------------------------
-CREATE OR REPLACE FUNCTION chat_room__edit (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, integer, varchar, varchar) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
+
+create or replace function chat_room__edit (integer, varchar, varchar, boolean, boolean, boolean, boolean, boolean)
+returns integer as '
declare
- p_pretty_name alias for $1;
- p_alias alias for $2;
+ p_room_id alias for $1;
+ p_pretty_name alias for $2;
p_description alias for $3;
- p_key_words alias for $4;
- p_maxP alias for $5;
- p_end_date alias for $6;
- p_Rss_service alias for $7;
- p_Mail_service alias for $8;
- p_moderated_p alias for $9;
- p_active_p alias for $10;
- p_archive_p alias for $11;
- p_user_id alias for $12;
- p_room_id alias for $13;
- p_frequency1 alias for $14;
- p_frequency_mail alias for $15;
+ p_moderated_p alias for $4;
+ p_active_p alias for $5;
+ p_archive_p alias for $6;
+ p_auto_flush_p alias for $7;
+ p_auto_transcript_p alias for $8;
begin
- update chat_rooms
- set pretty_name = p_pretty_name,
+ update chat_rooms set
+ pretty_name = p_pretty_name,
description = p_description,
- maximal_participants = p_maxP,
- end_date = p_end_date,
moderated_p = p_moderated_p,
active_p = p_active_p,
archive_p = p_archive_p,
- frequency1 = p_frequency1
- where
- room_id = p_room_id;
-
- update chat_registered_users
- set alias = p_alias,
- RSS_service = p_Rss_service,
- mail_service = p_Mail_service,
- frequency_mail = p_frequency_mail
- where
- room_id = p_room_id
- and user_id = p_user_id;
-
- return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
+ auto_flush_p = p_auto_flush_p,
+ auto_transcript_p = p_auto_transcript_p
+ where
+ room_id = p_room_id;
+ return 0;
+end;' language 'plpgsql';
---------------------------
-CREATE OR REPLACE FUNCTION chat_room__message_post (integer, varchar, integer, varchar) RETURNS integer AS'
+create function chat_room__message_post (integer, varchar, integer, varchar)
+returns integer as '
declare
p_room_id alias for $1;
p_msg alias for $2;
@@ -814,13 +583,13 @@
return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
+end;' language 'plpgsql';
---------------------------
-CREATE OR REPLACE FUNCTION chat_transcript__edit (integer, varchar, varchar, varchar) RETURNS integer AS'
+create function chat_transcript__edit (integer, varchar, varchar, varchar )
+returns integer as '
declare
p_transcript_id alias for $1;
p_pretty_name alias for $2;
@@ -836,379 +605,84 @@
return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
+end;' language 'plpgsql';
------------------------------
-CREATE OR REPLACE FUNCTION chat_room__insert_keywords (varchar, integer) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
-p_word alias for $1;
-p_room_id alias for $2;
-begin
-insert into chat_keywords
- (keyword,room_id)
- values
- (p_word, p_room_id);
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-----------------------------
-CREATE OR REPLACE FUNCTION chat_room__name (integer) RETURNS varchar AS'
-declare
- p_room_id alias for $1;
- v_pretty_name chat_rooms.pretty_name%TYPE;
-begin
- select into v_pretty_name pretty_name from chat_rooms where room_id = p_room_id;
- return v_pretty_name;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-----------------------------
-CREATE OR REPLACE FUNCTION chat_room__private_new (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, varchar, integer, varchar, varchar, boolean) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
- p_pretty_name alias for $1;
- p_alias alias for $2;
- p_description alias for $3;
- p_key_words alias for $4;
- p_maxP alias for $5;
- p_end_date alias for $6;
- p_Rss_service alias for $7;
- p_Mail_service alias for $8;
- p_moderated_p alias for $9;
- p_active_p alias for $10;
- p_archive_p alias for $11;
- p_context_id alias for $12;
- p_comm_name alias for $13;
- p_creation_user alias for $14;
- p_creation_ip alias for $15;
- p_object_type alias for $16;
- p_private alias for $17;
- v_room_id chat_rooms.room_id%TYPE;
- v_registered_id chat_rooms.room_id%TYPE;
- v_comm_name varchar;
-begin
- v_room_id := acs_object__new(null,''chat_room'',now(),p_creation_user,p_creation_ip,p_context_id );
- v_registered_id := acs_object__new(null,''chat_room'',now(),p_creation_user,p_creation_ip,p_context_id );
- insert into chat_rooms
- (room_id, pretty_name, description, moderated_p, active_p, archive_p, maximal_participants, end_date, creator, context_id,comm_name,auto_transcript_p,file_sent,private)
- values
- (v_room_id, p_pretty_name, p_description, p_moderated_p, p_active_p, p_archive_p, p_maxP, p_end_date,p_creation_user, p_context_id,v_comm_name,''true'',''false'',p_private);
- insert into chat_registered_users
- (alias, room_id, user_id, RSS_service, mail_service, registered_id)
- values
- (p_alias, v_room_id, p_creation_user, p_Rss_service, p_Mail_service, v_registered_id);
-return v_room_id;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-------------------------------------
-CREATE OR REPLACE FUNCTION chat_room__send_files (integer, varchar, varchar, varchar, date, integer, integer, varchar, integer) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
- p_chat_id alias for $1;
- p_file alias for $2;
- p_title alias for $3;
- p_description alias for $4;
- p_date alias for $5;
- p_context_id alias for $6;
- p_creation_user alias for $7;
- p_creation_ip alias for $8;
- p_send_file_id alias for $9;
-begin
- insert into chat_rooms_files_sent
- (room_id, file, title, description, date, send_file_id, message,creation_user)
- values
- (p_chat_id, p_file, p_title, p_description, p_date, p_send_file_id,''false'',p_creation_user);
-return p_send_file_id;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
------------------------------------------
-CREATE OR REPLACE FUNCTION chat_room__send_files_message (integer) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
-p_chat_id alias for $1;
-begin
-update chat_rooms_files_sent set
- message = ''true''
- where room_id = p_chat_id;
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
------------------------------------------
-CREATE OR REPLACE FUNCTION chat_rss__store_db (varchar, varchar, date, varchar,
-varchar, varchar, timestamp) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
-p_room_name alias for $1;
-p_room_description alias for $2;
-p_end_date alias for $3;
-p_r_creator alias for $4;
-p_comm_name alias for $5;
-p_registered_users alias for $6;
-p_entry_timestamp alias for $7;
-v_rss_id chat_rss.rss_id%TYPE;
-begin
-v_rss_id := acs_object__new(null,''chat_room'',now(),null,null,null );
-insert into chat_rss
- ( room_name, creator, end_date, description, comm_name,
-user_registered, rss_id,date, entry_timestamp)
- values
- (p_room_name, p_r_creator,p_end_date,
-p_room_description,p_comm_name,p_registered_users,v_rss_id,now(),p_entry_timestamp);
-return v_rss_id;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-------------------------------------------
-CREATE OR REPLACE FUNCTION chat_update_rss (varchar, varchar, timestamp, varchar, varchar, varchar, varchar) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
-p_room_name alias for $1;
-p_room_creator alias for $2;
-p_end_date alias for $3;
-p_room_description alias for $4;
-p_comm_name alias for $5;
-p_msg_creator alias for $6;
-p_registered_users alias for $7;
-begin
- update chat_rss set
- room_name = p_room_name,
- creator = p_room_creator,
- end_date = p_end_date,
- description = p_room_description,
- comm_name = p_comm_name,
--- xxx jopez no existe este campo ? msg_creator = p_msg_creator,
- user_registered = p_registered_users
- where room_id = p_room_id;
-
- return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
--------------------------------------
-CREATE OR REPLACE FUNCTION chat_upload (varchar, varchar, timestamp, varchar, varchar, varchar, varchar) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
-p_room_name alias for $1;
-p_room_creator alias for $2;
-p_end_date alias for $3;
-p_room_description alias for $4;
-p_comm_name alias for $5;
-p_msg_creator alias for $6;
-p_registered_users alias for $7;
-begin
- update chat_rss set
- room_name = p_room_name,
- creator = p_room_creator,
- end_date = p_end_date,
- description = p_room_description,
- comm_name = p_comm_name,
--- xxx jopez no existe este campo ? msg_creator = p_msg_creator
- user_registered = p_registered_users
- where rss_id = p_rss_id;
- return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
------------------------------------
-CREATE OR REPLACE FUNCTION chat_room__edit_admin (varchar, boolean, boolean, integer, integer, varchar, integer, varchar) RETURNS integer AS'
-/* Nuevo cuerpo de Function */
-declare
-
- p_alias alias for $1;
- p_Rss_service alias for $2;
- p_Mail_service alias for $3;
- p_context_id alias for $4;
- p_creation_user alias for $5;
- p_creation_ip alias for $6;
- p_room_id alias for $7;
- p_frequency_mail alias for $8;
- v_registered_id chat_rooms.room_id%TYPE;
-
- begin
-
- v_registered_id := acs_object__new(null,''chat_room'',now(),p_creation_user,p_creation_ip,p_context_id );
- if exists (select ru.user_id from chat_registered_users as ru where ru.room_id = p_room_id and ru.user_id = p_creation_user) then
- else
- insert into chat_registered_users
- (alias, room_id, user_id, RSS_service, mail_service, registered_id, frequency_mail)
- values
- (p_alias, p_room_id, p_creation_user, p_Rss_service, p_Mail_service, v_registered_id, p_frequency_mail);
- end if;
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
--------------------------------------
-CREATE OR REPLACE FUNCTION chat_room__store_transcripts_keywords (varchar, integer) RETURNS integer AS'
-/* New function body */
-declare
-p_keyword alias for $1;
-p_transcript_id alias for $2;
-begin
-insert into chat_room_transcript_keywords
- ( transcript_id,keyword)
- values
- (p_transcript_id,p_keyword);
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-------------------------------------------
-CREATE OR REPLACE FUNCTION chat_rss__store_keywords_rss (integer, varchar) RETURNS integer AS'
-/* New function body */
-declare
-p_rss_id alias for $1;
-p_keywords alias for $2;
-begin
-insert into chat_key_rss
- (rss_id,key)
- values
- (p_rss_id, p_keywords);
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
----------------------------------------------
-CREATE OR REPLACE FUNCTION chat_rss__store_partitipants_rss (integer, varchar) RETURNS integer AS'
-/* New function body */
-declare
-p_rss_id alias for $1;
-p_partitipant alias for $2;
-begin
-insert into chat_partitipants_rss
- ( partitipant,rss_id)
- values
- (p_partitipant,p_rss_id);
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-----------------------------------------------
-CREATE OR REPLACE FUNCTION chat_rss__store_sent_files_rss (integer, integer) RETURNS integer AS'
-/* New function body */
-declare
-p_rss_id alias for $1;
-p_file_id alias for $2;
-begin
-insert into chat_files_rss
- ( rss_id,file_id)
- values
- (p_rss_id, p_file_id);
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
----------------------------------------------
-CREATE OR REPLACE FUNCTION chat_rss__store_transcripts_rss (integer, integer) RETURNS integer AS'
-/* New function body */
-declare
-p_rss_id alias for $1;
-p_t_id alias for $2;
-begin
-insert into chat_transcription_rss
- ( rss_id,transcription_id)
- values
- (p_rss_id, p_t_id);
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-----------------------------------------------
-CREATE OR REPLACE FUNCTION chat_transcript__store_partitipants_transcript (integer, varchar) RETURNS integer AS'
-/* New function body */
-declare
-p_transcript_id alias for $1;
-p_partitipant alias for $2;
-begin
-insert into chat_partitipants_transcript
- ( transcript_id,partitipant)
- values
- (p_transcript_id,p_partitipant);
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-------------------------------------------------
-CREATE OR REPLACE FUNCTION chat_transcript__store_sent_files_tanscript (integer, integer) RETURNS integer AS'
-/* New function body */
-declare
-p_transcript_id alias for $1;
-p_f_id alias for $2;
-begin
-insert into chat_file_transcript
- ( transcript_id,file_id)
- values
- (p_transcript_id, p_f_id);
-return 0;
-end;
-'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
@@ -1229,79 +703,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: openacs-4/packages/chat/sql/postgresql/chat-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/sql/postgresql/chat-drop.sql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/sql/postgresql/chat-drop.sql 7 Jun 2007 09:14:24 -0000 1.3
+++ openacs-4/packages/chat/sql/postgresql/chat-drop.sql 19 Nov 2007 01:14:15 -0000 1.4
@@ -46,59 +46,25 @@
drop function chat_transcript__del (integer);
drop function chat_transcript__edit (integer, varchar, varchar, varchar );
-drop function chat_room__new (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, integer, integer, varchar, varchar, varchar);
+
+drop function chat_room__new (integer, varchar, varchar, boolean, boolean, boolean, integer, timestamptz, integer, varchar, varchar);
drop function chat_room__name (integer);
drop function chat_room__message_post (integer, varchar, integer, varchar);
-drop function chat_room__delete_registered_users (integer, integer);
-drop funciton chat_room_registered__user (varchar, integer, integer, boolean, boolean, integer, varchar);
-drop function chat_room__edit (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, integer, varchar);
+
+drop function chat_room__edit (integer, varchar, varchar, boolean, boolean, boolean);
drop function chat_room__message_count (integer);
drop function chat_room__delete_all_msgs (integer);
-drop function chat_room__insert_keywords (varchar, integer);
-
-drop function chat_room__send_files (integer, varchar, varchar, varchar, date, integer, integer, varchar);
-drop function chat_room__send_files_message (integer)
-
-drop function chat_rss__store_db (varchar, varchar, date, varchar, varchar, varchar, timestamp);
-drop function chat_update_rss ();
-drop function chat_upload ();
-
-drop function chat_room__private_new (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, integer, integer, varchar, varchar, boolean);
drop function chat_room__del (integer);
-drop function chat_room__edit_admin (varchar, boolean, boolean, integer, integer, varchar, integer);
-drop function chat_room__store_transcripts_keywords (varchar, integer);
-drop function chat_rss__store_keywords_rss (integer, varchar);
-drop function chat_rss__store_partitipants_rss (integer, varchar);
-drop function chat_rss__store_sent_files_rss (integer, integer);
-drop function chat_rss__store_transcripts_rss (integer, integer);
-drop function chat_transcript__store_partitipants_transcript (integer, varchar);
-drop function chat_transcript__store_sent_files_tanscript (integer, integer);
-
-
drop table chat_msgs;
-drop table chat_registered_users;
-drop table chat_file_transcript;
-drop table chat_files_rss;
-drop table chat_key_rss;
-drop table chat_partitipants_rss;
-drop table chat_partitipants_transcript;
-drop table chat_room_transcript_keywords;
-drop table chat_transcription_rss;
drop table chat_transcripts;
-drop table chat_keywords;
-drop table chat_private_room_users;
-drop table chat_room_user_id;
-drop table chat_rooms_files_sent;
-drop table chat_rss;
drop table chat_rooms;
-
--
-- Drop all chat privileges
--
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/chat/sql/postgresql/upgrade/upgrade-5.0d6-5.1d.sql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/tcl/chat-ajax-procs-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/tcl/chat-ajax-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-ajax-procs.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 22 Jun 2007 09:05:04 -0000 1.7
+++ openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 19 Nov 2007 01:14:16 -0000 1.8
@@ -9,75 +9,29 @@
namespace eval ::chat {
::xo::ChatClass Chat -superclass ::xo::Chat
-
-
- Chat instproc login {} {
- my instvar array user_id now chat_id
-
-
- db_1row room_info {
- select maximal_participants as maximal
- from chat_rooms as cp
- where cp.room_id = :chat_id
- }
- db_1row room_info {
- select count(cr.room_id) as count
- from chat_room_user_id as cr
- where cr.room_id = :chat_id
- }
- if { $count < $maximal} {
- db_1row room_info {
- select count(cr.room_id) as count2
- from chat_room_user_id as cr
- where cr.user_id = :user_id
- and cr.room_id = :chat_id
- }
- if { $count2 == 0 } {
- db_dml insert_users {insert into chat_room_user_id (room_id,user_id) values (:chat_id,:user_id);}
- }
- }
- if { $count == $maximal} {
-
- db_1row room_info {
- select count(chat_room_user_id.user_id) as count
- from chat_room_user_id
- where chat_room_user_id.user_id = :user_id
- and chat_room_user_id.room_id = :chat_id
- }
- if { $count == 0 } {
- if { [permission::permission_p -party_id $user_id -object_id [dotlrn::get_package_id] -privilege admin] } {
-
- } else {
-
- ns_return 200 text/html "\
- [_ chat.You_dont_have_permission_room]
\
- "
- ad_script_abort
- }
- }
- }
-
- if {![nsv_exists $array-last-activity $user_id]} {
- my add_msg -get_new false [_ xotcl-core.has_entered_the_room]
-
-
- }
- my encoder noencode
- my get_all
+ Chat instproc render {} {
+ my orderby time
+ set result ""
+ foreach child [my children] {
+ set msg [$child msg]
+ set user_id [$child user_id]
+ set color [$child color]
+ set timelong [clock format [$child time]]
+ set timeshort [clock format [$child time] -format {[%H:%M:%S]}]
+ set userlink [my user_link -user_id $user_id -color $color]
+ append result "$timeshort " \
+ "$userlink: " \
+ "[my encode $msg]
\n"
+ }
+ return $result
}
-
-
-
-
- Chat proc login {-chat_id -package_id -folder_id} {
+
+ Chat proc login {-chat_id -package_id} {
auth::require_login
if {![info exists package_id]} {set package_id [ad_conn package_id] }
if {![info exists chat_id]} {set chat_id $package_id }
-
-
-
set context id=$chat_id&s=[ad_conn session_id].[clock seconds]
set jspath packages/chat/www/ajax/chat.js
if { ![file exists [acs_root_dir]/$jspath] } {
@@ -86,638 +40,28 @@
set file [open [acs_root_dir]/$jspath]; set js [read $file]; close $file
set path [site_node::get_url_from_object_id -object_id $package_id]
set login_url ${path}ajax/chat?m=login&$context
- set send_url ${path}ajax/chat?m=add_msg&$context&msg=
- #$send_file
-
- set user_id [ad_conn user_id]
- set return_url [ad_return_url]
- db_1row room_info {
- select room.comm_name
- from chat_rooms as room
- where room.room_id = :chat_id
- }
- set folder_id "$comm_name's Public Files"
- db_1row room_info {
- select count(acs.object_id) as count
- from acs_objects as acs
- where acs.title = :folder_id
- }
- if { $count > 0 } {
- db_1row room_info {
- select acs.object_id as id
- from acs_objects as acs
- where acs.title = :folder_id
- }
- set folder_id $id
- } else {
- acs_user::get -user_id $user_id -array user
- set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
- set folder_id "$name's Shared Files"
-
- #$folder_id
- db_1row room_info {
- select fs.folder_id as id
- from fs_folders as fs
- where fs.name = :folder_id
- }
- set folder_id $id
- }
-
-
- set users_url ${path}ajax/chat?m=get_users&$context
-
- set files_url ${path}ajax/chat?m=get_files&$context
-
-
+ set send_url ${path}ajax/chat?m=add_msg&$context&msg=
+ set users_url ${path}ajax/chat?m=get_users&$context
return "\
-
+ "
}
-
- #test send files
-
- db_1row room_info1 {
- select count(files.message) as message
- from chat_rooms_files_sent as files
- where files.room_id = :chat_id
- and files.message = false
- }
-
- if { $message > 0 } {
- db_1row room_info1 {
- select files.title as title,files.file as fil
- from chat_rooms_files_sent as files
- where files.room_id = :chat_id
- and files.message = false
- }
-
-
-
-
-
-
- db_1row room_info {
- select room.comm_name
- from chat_rooms as room
- where room.room_id = :chat_id
- }
- set folder_id "$comm_name's Public Files"
-
- db_1row room_info {
- select count(acs.object_id) as count
- from acs_objects as acs
- where acs.title = :folder_id
- }
- if { $count > 0 } {
- db_1row room_info {
- select acs.object_id as id
- from acs_objects as acs
- where acs.title = :folder_id
- }
- set url [ad_conn url]
- set folder_id $id
- set inicio 0
- set final [expr [string length $url]-16]
- set comm_name [string range $url $inicio $final]
- if { [string length $comm_name] > 0 } {
- set url "$comm_name/file-storage/index?folder_id=$folder_id"
- }
- } else {
-
- acs_user::get -user_id $user_id -array user
- set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
- set folder_id "$name's Shared Files"
- #$folder_id
-
-
- db_1row room_info {
- select fs.folder_id as id
- from fs_folders as fs
- where fs.name = :folder_id
- }
- set folder_id $id
- set url "/dotlrn/file-storage/index?folder_id=$folder_id"
- }
-
-
-
- set user_file -1
-
-
- set userlink [my user_link -user_id "-1" -color ""]
- set msg_file [my user_link4 -url "I has uploaded the '$title' file ($fil) to the " -color ""]
- append result2 ""
-
- append msg_file [my user_link5 -url "$url" -msg "public files of the community" -color ""]
-
- append result2 $msg_file
- append result2 " "
- append result2 " \n"
- set delete_message [send_file_message $chat_id]
- set uid -1
- set m [my add_msg -get_new true -uid $user_id "$result2"]
-
- set userlink [my user_link -user_id $user_file -color ""]
- append result "$timeshort $userlink: "
- append result ""
- set msg_file [my user_link4 -url "The file '$title' has been sent to the " -color ""]
- append msg_file [my user_link5 -url "$url" -msg "public files of the community." -color ""]
- append result $msg_file
- append result " "
- append result "
\n"
-
-
- }
-
- return $result
- }
-
-
- Chat instproc get_files {} {
- my instvar chat_id
- set output ""
- set count 0
- ns_log Notice "en el get files... $output"
-
-
- db_foreach file "select distinct fil.file as file
- from chat_rooms_files_sent as fil
- where fil.room_id = :chat_id " {
-
-
- set url [ad_conn url]
-
- set inicio 0
- set final [expr [string length $url]-16]
- set comm_name [string range $url $inicio $final]
-
- if { [string length $comm_name] > 0 } {
- append output "$file "
- } else {
- set user_id [ad_conn user_id]
- acs_user::get -user_id $user_id -array user
- set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
- set folder_id "$name's Shared Files"
-
- db_1row room_info {
- select fs.folder_id as id
- from fs_folders as fs
- where fs.name = :folder_id
- }
- set folder_id $id
- append url_file "dotlrn_fs_" $user_id
- append url_file "_root_folder"
- append url_file2 "dotlrn_fs_" $user_id
- append url_file2 "_shared_folder"
-
- append output "$file "
-
- }
- } if_no_rows {
- append output "[_ chat.no_files] "
- }
-
- return $output
- }
-
-
-
-
- Chat instproc sweeper {} {
- my instvar array now chat_id
- my log "-- starting"
-
-
- foreach {user timestamp} [nsv_array get $array-last-activity] {
- ns_log Notice "YY at user $user with $timestamp"
- set ago [expr {($now - $timestamp) / 1000}]
-
-
- if {$ago > 1000} {
- my add_msg -get_new false -uid $user "auto logout"
- db_dml insert_users {delete from chat_room_user_id where room_id = :chat_id and user_id = :user;}
- nsv_unset $array-last-activity $user
- nsv_unset $array-color $user
- nsv_unset $array-login $user
-
- }
-
- }
- my log "-- ending"
- }
-
-
- Chat instproc get_users {} {
- my instvar chat_id
- set output ""
- set count 0
-
-
-
- foreach {user_id timestamp} [my active_user_list] {
-
-
- set count [expr $count+1]
- if {$user_id > 0} {
- db_1row room_info {
- select count(1) as info
- from chat_registered_users
- where room_id = :chat_id
- and user_id = :user_id
- }
- if { $info > 0 } {
- db_1row room_info {
- select alias as alias
- from chat_registered_users
- where room_id = :chat_id
- and user_id = :user_id
- }
-
- set pp [my sweeper]
-
-
-
- set color [my user_color $user_id]
- set diff [clock format [expr {[clock seconds] - $timestamp}] -format "%H:%M:%S" -gmt 1]
-
- set package_id [ad_conn package_id]
- db_1row url {
- select site_node__url(node_id) as url
- from site_nodes
- where object_id=:package_id
- }
-
- set userlink [my user_link2 -user_id $user_id -alias $alias]
- set user_id2 [ad_conn user_id]
- set url2 "private-room?room_id=$chat_id&user_id1=$user_id&user_id2=$user_id2"
- append link $url $url2
- set address [my encode $link]
- set narrow [dt_right_arrow]
- ns_log Notice "URL---------------$link---------$userlink"
- append output "$userlink $diff "
-
- }
- if { $info eq 0 } {
- set link ""
- set package_id [ad_conn package_id]
- db_1row url {
- select site_node__url(node_id) as url
- from site_nodes
- where object_id=:package_id
- }
- set diff [clock format [expr {[clock seconds] - $timestamp}] -format "%H:%M:%S" -gmt 1]
- set userlink [my user_link -user_id $user_id]
- set user_id2 [ad_conn user_id]
- set url2 "private-room?room_id=$chat_id&user_id1=$user_id&user_id2=$user_id2"
- append link $url $url2
- set address [my encode $link]
- set narrow [dt_right_arrow]
- ns_log Notice "URL---------------$link---------$userlink"
- append output "$userlink $diff "
- }
- }
- }
-
- return $output
- }
+}
-
-
-Chat instproc logout {} {
- my instvar array user_id chat_id
- my add_msg -get_new false [_ chat.has_left_the_room].
-
- db_dml insert_users {delete from chat_room_user_id where room_id = :chat_id and user_id = :user_id;}
-
- catch {
- nsv_unset $array-last-activity $user_id
- nsv_unset $array-login $user_id
- nsv_unset $array-color $user_id
- }
- }
-
-
-
- Chat instproc user_link { -user_id -color } {
- my instvar chat_id
- if {$user_id > 0} {
- set name [my user_name $user_id]
- set url "/shared/community-member?user%5fid=$user_id"
- if {![info exists color]} {
- set color [my user_color $user_id]
- }
- set user_id2 [ad_conn user_id]
- set user_info "#chat.user_info#"
- set creator "$name "
- } elseif { $user_id == 0 } {
- set creator "Nobody"
- } else {
- set creator "System"
- }
- return [my encode $creator]
- }
-
-
-
- Chat instproc user_link2 { -user_id -color -alias} {
- my instvar chat_id
- if {$user_id > 0} {
- set name $alias
- set url "/shared/community-member?user%5fid=$user_id"
- set user_id2 [ad_conn user_id]
- if {![info exists color]} {
- set color [my user_color $user_id]
- }
- set user_info "#chat.user_info#"
- set creator "$alias "
- ns_log Notice "El creator vale---------------$creator"
- } elseif { $user_id == 0 } {
- set creator "Nobody"
- } else {
- set creator "System"
- }
- set tt [my encode $creator]
- ns_log Notice "El creator a string vale $tt"
- return [my encode $creator]
- }
-
- Chat instproc user_link3 { -url -color} {
- set creator "$url "
-
- return [my encode $creator]
- }
-
- Chat instproc user_link4 { -url -color} {
- set creator "$url "
-
- return [my encode $creator]
- }
-
- Chat instproc user_link5 { -url -msg -color} {
- set creator "$msg "
-
- return [my encode $creator]
- }
-
-
- Chat instproc add_msg {{-get_new:boolean true} -uid msg} {
- my instvar array now user_id chat_id
-
- if { $get_new eq "true" } {
-
- db_1row room_info {
- select count(cr.room_id) as count
- from chat_room_user_id as cr
- where cr.room_id = :chat_id
- and cr.user_id = :user_id
- }
- if { $count == 1 || [permission::permission_p -party_id $user_id -object_id [dotlrn::get_package_id] -privilege admin]} {
- set user_id [expr {[info exists uid] ? $uid : [my set user_id]}]
- set color [my user_color $user_id]
- set msg $msg
-
- if {$get_new && [info command ::thread::mutex] ne ""} {
-
- my broadcast_msg [Message new -volatile -time [clock seconds] \
- -user_id $user_id -msg $msg -color $color]
-
- }
-
- set msg_id $now.$user_id
- if { ![nsv_exists $array-login $user_id] } {
- nsv_set $array-login $user_id [clock seconds]
- }
-
- nsv_set $array $msg_id [list $now [clock seconds] $user_id $msg $color]
- nsv_set $array-seen newest $now
- nsv_set $array-seen last [clock seconds]
- nsv_set $array-last-activity $user_id $now
- if {$get_new} {my get_new}
- }
-
-
- } else {
-
- set user_id [expr {[info exists uid] ? $uid : [my set user_id]}]
- set color [my user_color $user_id]
-
- set msg $msg
-
-
- if {$get_new && [info command ::thread::mutex] ne ""} {
-
- my broadcast_msg [Message new -volatile -time [clock seconds] \
- -user_id $user_id -msg $msg -color $color]
-
- }
-
- set msg_id $now.$user_id
- if { ![nsv_exists $array-login $user_id] } {
- nsv_set $array-login $user_id [clock seconds]
- }
- nsv_set $array $msg_id [list $now [clock seconds] $user_id $msg $color]
- nsv_set $array-seen newest $now
- nsv_set $array-seen last [clock seconds]
- nsv_set $array-last-activity $user_id $now
- if {$get_new} {my get_new}
- }
-
- }
-
-
-}
Index: openacs-4/packages/chat/tcl/chat-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-init.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/tcl/chat-init.tcl 7 Jun 2007 09:14:24 -0000 1.3
+++ openacs-4/packages/chat/tcl/chat-init.tcl 19 Nov 2007 01:14:16 -0000 1.4
@@ -10,5 +10,6 @@
nsv_set chat new_message [ns_mutex create]
nsv_set chat server_started 0
-
-ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 18 05] chat_flush_rooms
+
+ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 0 5] chat_flush_rooms
+
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/tcl/chat-install-procs.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/tcl/chat-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/Attic/chat-procs-postgresql.xql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/chat/tcl/chat-procs-postgresql.xql 24 Jun 2007 15:21:19 -0000 1.5
+++ openacs-4/packages/chat/tcl/chat-procs-postgresql.xql 19 Nov 2007 01:14:16 -0000 1.6
@@ -3,165 +3,26 @@
postgresql 7.1
- select chat_room__new (
+ select chat_room__new (
+ NULL,
:pretty_name,
- :alias,
:description,
- :key_words,
- :maxP,
- timestamp :end_date,
- boolean :Rss_service,
- boolean :Mail_service,
- boolean :moderated_p,
- boolean :active_p,
- boolean :archive_p,
- integer :context_id,
- varchar :comm_name,
- integer :creation_user,
- varchar :creation_ip,
- varchar 'chat_room',
- varchar :frequency1,
- varchar :frequency2
+ :moderated_p,
+ :active_p,
+ :archive_p,
+ :auto_flush_p,
+ :auto_transcript_p,
+ :context_id,
+ now(),
+ :creation_user,
+ :creation_ip,
+ 'chat_room'
)
-
-
- select chat_room__insert_keywords (
- :word,
- :room_id
- )
-
-
-
-
- select chat_room__insert_keywords (
- :word,
- :room_id
- )
-
-
-
-
- select chat_room__private_new (
- varchar :pretty_name,
- varchar :alias,
- varchar :description,
- varchar :key_words,
- integer :maxP,
- timestamp :end_date,
- boolean :Rss_service,
- boolean :Mail_service,
- boolean :moderated_p,
- boolean :active_p,
- boolean :archive_p,
- integer :context_id,
- varchar :comm_name,
- integer :creation_user,
- varchar :creation_ip,
- varchar 'chat_room',
- boolean :private
- )
-
-
-
-
-
- select '$from' as from_addr,
- '$sender_first_names' as sender_first_names,
- '$sender_last_name' as sender_last_name,
- parties.email as email
- from dotlrn_member_rels_full,parties
- where dotlrn_member_rels_full.community_id = '2267'
- and parties.party_id = dotlrn_member_rels_full.user_id
-
-
-
-
-
- select '$from' as from_addr,
- '$sender_first_names' as sender_first_names,
- '$sender_last_name' as sender_last_name,
- parties.email as email
- from dotlrn_member_rels_full,parties
- where dotlrn_member_rels_full.community_id = '$community_id'
- and parties.party_id = dotlrn_member_rels_full.user_id
- and parties.party_id = '$user_id'
-
-
-
-
-
-
-
- select '$from' as from_addr,
- '$sender_first_names' as sender_first_names,
- '$sender_last_name' as sender_last_name,
- parties.email,
- CASE
- WHEN
- acs_objects.object_type = 'user'
- THEN
- (select first_names
- from persons
- where person_id = parties.party_id)
- WHEN
- acs_objects.object_type = 'group'
- THEN
- (select group_name
- from groups
- where group_id = parties.party_id)
- WHEN
- acs_objects.object_type = 'rel_segment'
- THEN
- (select segment_name
- from rel_segments
- where segment_id = parties.party_id)
- ELSE
- ''
- END as first_names,
- CASE
- WHEN
- acs_objects.object_type = 'user'
- THEN
- (select last_name
- from persons
- where person_id = parties.party_id)
- ELSE
- ''
- END as last_name,
- '$safe_community_name' as community_name,
- '$community_url' as community_url
- from acs_rels,
- parties,
- acs_objects
- where (acs_rels.object_id_one = $community_id
- and acs_rels.object_id_two = parties.party_id
- and parties.party_id = acs_objects.object_id
- and parties.party_id in (select acs_rels.object_id_two
- from acs_rels, membership_rels
- where acs_rels.object_id_one = acs__magic_object_id('registered_users')
- and acs_rels.rel_id = membership_rels.rel_id
- and membership_rels.member_state = 'approved' ))
- $who_will_receive_this_clause
-
-
-
-
-
- select parties.email as sender_email,
- persons.first_names as sender_first_names,
- persons.last_name as sender_last_name
- from parties,
- persons
- where parties.party_id = :sender_id
- and persons.person_id = :sender_id
-
-
-
-- Automatic grant room privilege to creator of the room (must not be null).
@@ -251,61 +112,39 @@
return 0;
end;
-
+
+
- begin
+ begin
perform chat_room__edit (
+ :room_id,
:pretty_name,
- :alias,
:description,
- :key_words,
- :maxP,
- :end_date,
- :Rss_service,
- :Mail_service,
:moderated_p,
:active_p,
- :archive_p,
- :user_id,
- :room_id,
- :frequency1,
- :frequency_mail
+ :archive_p,
+ :auto_flush_p,
+ :auto_transcript_p
);
return 0;
end;
-
-
- select chat_room__edit_admin (
- :alias,
- :Rss_service,
- :Mail_service,
- :context_id,
- :user_id,
- :creation_ip,
- :room_id,
- :frequency_mail
- )
-
-
-
select chat_room__message_count(:room_id);
-
-
+
- begin
- perform chat_room__delete_registered_users(:room_id,:user_id);
+ begin
+ perform chat_room__delete_all_msgs(:room_id);
return 0;
end;
@@ -382,164 +221,5 @@
-
-
-
- select chat_room__store_transcripts_keywords (
- :word,
- :transcript_id
- )
-
-
-
-
-
-
- select chat_room_registered__user (
- varchar :alias,
- integer :user_id,
- integer :room_id,
- boolean :RSS_service,
- boolean :mail_service,
- integer :context_id,
- varchar :creation_ip,
- varchar :frequency_mail
- )
-
-
-
-
-
-
- select chat_room__send_files (
- integer :chat_id,
- varchar :file,
- varchar :title,
- varchar :description,
- date :date,
- integer :context_id,
- integer :creation_user,
- varchar :creation_ip,
- integer :send_file_id
- )
-
-
-
-
-
- begin
- perform chat_room__send_files_message (:chat_id);
- return 0;
- end;
-
-
-
-
-
-
- select max(o.last_modified) as last_updated
- from acs_objects o, chat_rooms cr
- where cr.context_id=:package_id
- and o.object_id=cr.room_id
-
-
-
-
-
- select cr.room_id as item_id,
- cr.pretty_name as title,
- to_char(o.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified
- from chat_rooms cr,
- acs_objects o
- where cr.context_id=:package_id
- and o.object_id = cr.room_id
- and cr.room_id=:summary_context_id
- order by o.last_modified desc
- limit $limit
-
-
-
-
-
-
-
- select chat_rss__store_db (
- varchar :room_name,
- varchar :room_description,
- date :end_date,
- varchar :r_creator,
- varchar :comm_name,
- varchar :registered_users,
- timestamp :entry_timestamp
- );
-
-
-
-
-
-
- select chat_rss__store_partitipants_rss (
- :rss_id,
- :partitipant
- );
-
-
-
-
-
- select chat_transcript__store_partitipants_transcript (
- :transcript_id,
- :partitipant
- );
-
-
-
-
-
- select chat_rss__store_sent_files_rss (
- :rss_id,
- :send_file_id
- );
-
-
-
-
-
- select chat_transcript__store_sent_files_tanscript (
- :transcript_id,
- :f_id
- );
-
-
-
-
-
- select chat_rss__store_keywords_rss (
- :rss_id,
- :key
- );
-
-
-
-
-
-
- select chat_rss__store_transcripts_rss (
- :rss_id,
- :transcription_id
- );
-
-
-
-
-
-
- select fs.send_file_id as f_id
- from chat_files_sent fs
- where room_id = :room_id
- and date >= :time
-
-
-
Index: openacs-4/packages/chat/tcl/chat-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-procs.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/chat/tcl/chat-procs.tcl 24 Jun 2007 15:21:19 -0000 1.10
+++ openacs-4/packages/chat/tcl/chat-procs.tcl 19 Nov 2007 01:14:16 -0000 1.11
@@ -2,15 +2,14 @@
ad_library {
TCL Library for the chat system v.4
- @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
-
+ @author David Dao (ddao@arsdigita.com)
+ @creation-date November 17, 2000
+ @cvs-id $Id$
}
-namespace eval chat::rss {}
-
ad_proc -private chat_start_server {} { Start Java chat server. } {
- if {[nsv_get chat server_started]} {
+ if [nsv_get chat server_started] {
return
}
ns_log notice "chat_start_server: Starting chat server"
@@ -63,7 +62,7 @@
while { 1 } {
# Wait until there is new message in queue.
ns_mutex lock [nsv_get chat new_message]
- if {[nsv_exists chat html_message]} {
+ if [nsv_exists chat html_message] {
# Get message from queue.
puts $w [nsv_get chat html_message]
flush $w
@@ -99,7 +98,7 @@
regexp "(.*) " $line match screen_name
regexp "(.*)" $line match msg
regexp "(.*) " $line match user_id
- if {![nsv_exists chat_room $room_id]} {
+ if ![nsv_exists chat_room $room_id] {
nsv_set chat_room $room_id {}
}
@@ -119,12 +118,12 @@
}
}
- chat_room_get -room_id $room_id -array room_info
- if { $room_info(archive_p) eq "t" } {
- if {[catch {chat_post_message_to_db -creation_user $user_id $room_id $msg} errmsg]} {
- ns_log error "chat_post_message_to_db: error: $errmsg"
- }
- }
+ chat_room_get -room_id $room_id -array room_info
+ if { $room_info(archive_p) eq "t" } {
+ if [catch {chat_post_message_to_db -creation_user $user_id $room_id $msg} errmsg] {
+ ns_log error "chat_post_message_to_db: error: $errmsg"
+ }
+ }
nsv_lappend chat_room $room_id $line
@@ -143,138 +142,48 @@
} {
Log chat message to the database.
} {
-
+ # ns_log Notice $msg
db_exec_plsql post_message {}
}
-ad_proc -public chat_room_new {
- {-alias ""}
- {-key_words ""}
- {-maxP ""}
- {-end_date ""}
- {-Rss_service ""}
- {-frequency1 ""}
- {-frequency2 ""}
- {-Mail_service ""}
- {-moderated_p ""}
- {-active_p ""}
- {-archive_p ""}
- {-auto_flush_p ""}
- {-auto_transcript_p ""}
- {-context_id ""}
- {-comm_name ""}
+ad_proc -public chat_room_new {
+ {-description ""}
+ {-moderated_p f}
+ {-active_p t}
+ {-archive_p f}
+ {-auto_flush_p t}
+ {-auto_transcript_p f}
+ {-context_id ""}
{-creation_user ""}
{-creation_ip ""}
- description
pretty_name
+
} {
Create new chat room. Return room_id if successful else raise error.
} {
-
db_transaction {
set room_id [db_exec_plsql create_room {}]
}
db_exec_plsql grant_permission {}
-
- for {set i 0} {$i < [llength $key_words]} {incr i 1} {
- set word [lindex $key_words $i]
-
- db_exec_plsql insert_keywords { }
- }
-
-
return $room_id
}
-ad_proc -public chat_room_private_new {
- {-alias ""}
- {-key_words ""}
- {-maxP ""}
- {-end_date ""}
- {-Rss_service ""}
- {-Mail_service ""}
- {-moderated_p ""}
- {-active_p ""}
- {-archive_p ""}
- {-auto_flush_p ""}
- {-auto_transcript_p ""}
- {-context_id ""}
- {-comm_name ""}
- {-creation_user ""}
- {-creation_ip ""}
- {-private ""}
- description
- pretty_name
-} {
- Create new chat room. Return room_id if successful else raise error.
-} {
-
- db_transaction {
- set room_id [db_exec_plsql create_private_room {}]
- }
-
-
-
- return $room_id
-}
-
ad_proc -public chat_room_edit {
- {-alias ""}
- {-key_words ""}
- {-maxP ""}
- {-end_date ""}
- {-Rss_service ""}
- {-frequency1 ""}
- {-frequency_mail ""}
- {-Mail_service ""}
- {-moderated_p ""}
- {-active_p ""}
- {-archive_p ""}
- {-user_id ""}
- {-room_id ""}
- description
+ room_id
pretty_name
+ description
+ moderated_p
+ active_p
+ archive_p
+ auto_flush_p
+ auto_transcript_p
} {
Edit information on chat room. All information require.
} {
-
- for {set i 0} {$i < [llength $key_words]} {incr i 1} {
- set word [lindex $key_words $i]
-
- db_1row room_info {
- select count(ck.room_id) as words
- from chat_keywords ck
- where ck.room_id = :room_id
- and ck.keyword = :word
- }
- if { $words eq 0 } {
- db_exec_plsql insert_keywords { }
- }
- }
-
- db_exec_plsql edit_room {}
-
-
- #A professor who creates a rooom will be able to admin it.
- db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- return 0
- } else {
- set context_id [ad_conn package_id]
- set creation_ip [ad_conn peeraddr]
- db_exec_plsql edit_room_admin {}
- return 0
- }
-
-
+ db_exec_plsql edit_room {}
}
ad_proc -public chat_room_delete {
@@ -426,10 +335,7 @@
Return display name of this user to use in chat.
} {
acs_user::get -user_id $user_id -array user
-
-
set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
-
return $name
}
@@ -463,22 +369,20 @@
if { $room_info(archive_p) eq "f" } { return }
# write message to the database
- if {[catch {chat_post_message_to_db -creation_user $user_id $room_id $message} errmsg]} {
+ if [catch {chat_post_message_to_db -creation_user $user_id $room_id $message} errmsg] {
ns_log error "chat_post_message_to_db: error: $errmsg"
}
}
-
-
ad_proc -public chat_moderate_message_post {
room_id
user_id
message
} {
Post moderate message to the chat room and broadcast to all applet clients. Only use by HTML client.
} {
- set chat_msg "[chat_user_name2 $user_id $alias] $user_id $room_id $messagepending "
+ set chat_msg "[chat_user_name $user_id] $user_id $room_id $messagepending "
# Add message to queue. Notify thread responsible for broadcast message to applets.
nsv_set chat html_message $chat_msg
@@ -497,7 +401,7 @@
# The first time html client enter chat room, chat_room variable is not initialize correctly.
# Therefore I just hard code the variable.
- if {![nsv_exists chat_room $room_id]} {
+ if ![nsv_exists chat_room $room_id] {
nsv_set chat_room $room_id [list "[chat_user_name $user_id] $room_id [_ chat.has_entered_the_room]approved "]
}
@@ -513,14 +417,14 @@
set counter 0
#foreach msg $chat_messages
- for { set i [expr {$cnt - 1}] } { $i >= 0 } { set i [expr {$i - 1}] } {
+ for { set i [expr $cnt - 1] } { $i >= 0 } { set i [expr $i - 1] } {
set msg [lindex $chat_messages $i]
regexp "(.*) " $msg match screen_name
regexp "(.*)" $msg match chat_msg
regexp "(.*) " $msg match status
- if {$status eq "pending" || $status eq "rejected"} {
+ if {$status == "pending" || $status == "rejected"} {
continue;
}
@@ -531,7 +435,7 @@
incr counter
set array_val(rownum) $counter
- if {$screen_name == $user_name && $chat_msg eq "has entered the room."} {
+ if {$screen_name == $user_name && $chat_msg == "has entered the room."} {
return
}
}
@@ -544,7 +448,6 @@
{-context_id ""}
{-creation_user ""}
{-creation_ip ""}
- {-keywords ""}
pretty_name
contents
room_id
@@ -576,33 +479,14 @@
transcript_id
pretty_name
description
- contents
+ contents
} {
Edit chat transcript.
} {
db_exec_plsql edit_transcript {}
db_dml update_contents {}
}
-ad_proc -public chat_transcript_edit_keywords {
- transcript_id
- keywords
-} {
- Edit chat transcript.
-} {
- for {set i 0} {$i < [llength $keywords]} {incr i 1} {
- set word [lindex $keywords $i]
-
- db_1row select_keywords {select count(ck.keyword) as ckey from chat_room_transcript_keywords ck where ck.transcript_id = :transcript_id and ck.keyword = :word}
- if { $ckey > 0 } {
- } else {
- db_exec_plsql store_transcripts_keywords {}
- }
- }
-
-
-}
-
ad_proc -public chat_room_get {
{-room_id {}}
{-array:required}
@@ -621,1245 +505,32 @@
}
ad_proc -private chat_flush_rooms {} {Flush the messages in all of the chat rooms} {
-
+ # ns_log Notice "YY Starting chat_flush_rooms operation"
set room_ids [db_list get_rooms *SQL*]
foreach room_id $room_ids {
chat_room_flush $room_id
}
-}
-
+}
ad_proc -private chat_room_flush { room_id } {Flush the messages a single chat room} {
-
+ # ns_log Notice "YY flushing room $room_id"
db_transaction {
array set room_info [chat_room_get_not_cached $room_id]
set contents ""
# do we have to create a transcript for the room
- if { $room_info(auto_transcript_p) eq "t" } {
- set time [clock format [expr [clock seconds]-86400] -format "%D"]
- # build a list of all messages
- db_foreach get_archives_messages {} {
-
- if { $creation_user eq "-1" } {
- append contents "\[$creation_date\] System : $msg \n"
- } else {
- db_1row room_info2 {
- select count(r.alias)
- from chat_registered_users r
- where r.user_id = :creation_user
- and r.room_id = :room_id
- }
-
- if { $count > 0} {
- db_1row room_info2 {
- select r.alias
- from chat_registered_users r
- where r.user_id = :creation_user
- and r.room_id = :room_id
- }
- append contents "\[$creation_date\] [chat_user_name2 $creation_user $alias] : $msg \n"
- } else {
- append contents "\[$creation_date\] [chat_user_name $creation_user] : $msg \n"
- }
- }
- #append contents "\[$creation_date\] [chat_user_name $creation_user] : $msg \n"
- }
-
+ if { $room_info(auto_transcript_p) eq "t" } {
+ # build a list of all messages
+ db_foreach get_archives_messages {} {
+ append contents "\[$creation_date\] [chat_user_name $creation_user] : $msg \n"
+ }
if { $contents ne "" } {
-
- set transcript_id [chat_transcript_new \
+ chat_transcript_new \
-description "#chat.automatically_created_transcript#" \
- "#chat.transcript_of_date# [clock format [clock seconds] -format "%d.%m.%Y"]" $contents $room_id]
- set time [clock format [expr [clock seconds]-86400] -format "%D"]
- db_foreach get_files_sent {} {
- set ft [store_sent_files_tanscript $transcript_id $f_id]
- }
-
- db_foreach partitipants_transcript "select distinct msg.creation_user as msg_creator
- from chat_msgs as msg
- where msg.room_id = :room_id and creation_date >= :time and msg.creation_user>-1" {
-
- #append de los participantes
-
- db_1row room_info {
- select count(r.alias) as count
- from chat_registered_users r
- where r.room_id = :room_id
- and r.user_id = :msg_creator
- }
-
- if { $count > 0 } {
- db_1row room_info {
- select r.alias as partitipant
- from chat_registered_users r
- where r.room_id = :room_id
- and r.user_id = :msg_creator
- }
- } else {
- db_1row room_info {
- select p.first_names as first_names, p.last_name as last_name
- from persons p
- where p.person_id = :msg_creator
- }
- append msg_creator1 $first_names " "
- append partitipant $msg_creator1 $last_name
- }
-
- set pt [store_partitipants_transcript $transcript_id $partitipant]
-
-
- } if_no_rows {
-
- }
+ "#chat.transcript_of_date# [clock format [clock seconds] -format "%d.%m.%Y"]" $contents $room_id
}
- }
- # clear all the messages in the room
- #chat_room_message_delete $room_id
- }
-}
-
-ad_proc -public chat_registered_user {
- {-RSS_service ""}
- {-mail_service ""}
- {-context_id ""}
- {-creation_ip ""}
- {-frequency_mail ""}
- room_id
- alias
- user_id
-} {
- A user is regitered in a chat room.
-} {
-
- db_transaction {
- set registered_id [db_exec_plsql register {}]
- }
-
- return $registered_id
-}
-
-ad_proc -public chat_send_mails {
- room_id
- community_id
- user_id
- package_id
- frequency
-} {
- Send mails to the registered users with the brief of the chat room conversation
-} {
-
- db_1row info {
- select r.frequency_mail,
- to_char(r.registered_date, 'YYYY-MM-DD HH24:MI:SS') as registered_date
- from chat_registered_users r
- where r.room_id = :room_id
- and r.user_id = :user_id
- }
-
- set entry_date_ansi [lc_time_tz_convert -from [lang::system::timezone] -to "Etc/GMT" -time_value $registered_date]
- set entry_timestamp [clock scan $entry_date_ansi]
-
- switch $frequency_mail {
- "dayly" {
- set mail_time [expr [clock seconds]-86400]
-
- }
- "weekly" {
- set mail_time [expr [clock seconds]-604800]
- }
- "monthly" {
- set mail_time [expr [clock seconds]-2592000]
- }
- }
-
- if { !($mail_time eq $entry_timestamp) } {
- # the mail does not have to be sent
- return
- }
-
- set sende_first_names ""
- set sender_last_name ""
- set sender_email ""
- db_foreach room_info "select user_id as user_id from chat_registered_users where chat_registered_users.room_id = :room_id" {
-
- set sender_id $user_id
- db_1row select_sender_info {
-
- select parties.email as sender_email,
- persons.first_names as sender_first_names,
- persons.last_name as sender_last_name
- from parties,persons
- where parties.party_id = :sender_id
- and persons.person_id = :sender_id
- }
-
- db_1row query {
- select parties.email as email
- from dotlrn_member_rels_full,parties
- where dotlrn_member_rels_full.community_id = :community_id
- and parties.party_id = dotlrn_member_rels_full.user_id
- and parties.party_id = :user_id
- }
-
-
-
-
-
- set from $sender_email
-
-
- if { $community_id eq "" } {
- set community_name "All Dotlrn communities"
- set community_url "Dotlrn"
- set safe_community_name [db_quote $community_name]
- append who_will_receive_this_clause [db_map recipients_clause]
- set query [db_map sender_info]
-
- } else {
- set community_name [dotlrn_community::get_community_name_not_cached $community_id]
- set community_url "[ad_parameter -package_id [ad_acs_kernel_id] SystemURL][dotlrn_community::get_community_url $community_id]"
- set safe_community_name [db_quote $community_name]
- append who_will_receive_this_clause [db_map recipients_clause]
-
- set query [db_map sender_info4]
-
- }
-
-
- set send_date [template::util::date::now_min_interval]
-
- db_1row room_info {
- select r.pretty_name as name,r.comm_name as comm_name,r.description as description,p.first_names as first_names, p.last_name as last_name
- from chat_rooms as r, persons as p
- where r.room_id = :room_id
- and p.person_id = r.creator
- }
- db_1row room_info2 { select count(fs.title) as count
- from chat_rooms as r, chat_rooms_files_sent as fs
- where r.room_id = :room_id
- and r.room_id = fs.room_id }
-
- if { $count > 0 } {
- db_1row room_info2 { select fs.title as file_name, fs.description as fdescription,fs.creation_user as sender
- from chat_rooms as r, chat_rooms_files_sent as fs
- where r.room_id = :room_id
- and r.room_id = fs.room_id }
- db_0or1row sf2 {
- select p.first_names as sender_first_names, p.last_name as sender_last_name
- from persons p
- where p.person_id = :sender
- }
- append sender_name1 $sender_first_names " "
- append sender_name $sender_name1 $sender_last_name
-
- }
- set partitipants ""
-
- db_foreach rss_partitipants "select distinct persons.first_names as first_names, persons.last_name as last_name
- from chat_msgs as msg,persons
- where msg.room_id = :room_id
- and msg.creation_user = persons.person_id" {
- #append de los participantes
- append partitipants $first_names " "
- append partitipants $last_name " "
- append partitipants " |" " "
-
- } if_no_rows {
-
- set partitipants "There are not partitipants"
- }
-
-
- if { [string index $partitipants [expr [string length $partitipants]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $partitipants]-3]
-
- set partitipants [string range $partitipants $inicio $final]
-
- }
-
- set registered_users ""
- db_foreach rss_registered "select distinct registered.alias as users
- from chat_registered_users as registered
- where registered.room_id = :room_id" {
- #append de los participantes
- append registered_users $users " | "
- } if_no_rows {
-
- set registered_users "There are not registered users"
- }
-
-
-
- if { [string index $registered_users [expr [string length $registered_users]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $registered_users]-3]
- set registered_users [string range $registered_users $inicio $final]
-
- }
-
- set keywords ""
- db_foreach keywords "select k.keyword as key from chat_keywords as k
- where k.room_id = :room_id" {
- #append de las keywords
- append keywords $key " | "
- } if_no_rows {
-
- set keywords "There are not keywords"
- }
- if { [string index $keywords [expr [string length $keywords]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $keywords]-3]
- set keysw [string range $keywords $inicio $final]
- }
-
- set subject "$name conversations brief"
- if { $count > 0 } {
- set message "This is a brief of the conversations during the $frequency: \r\n\r\n Room name --> $name \r\n\r\n Community name --> $comm_name \r\n\r\n Description --> $description \r\n\r\n Creator --> $first_names $last_name \r\n\r\n Keywords --> $keysw \r\n\r\n Partitipants --> $partitipants \r\n\r\n Registered users --> $registered_users \r\n\r\n File Title--> $file_name \r\n\r\n File description --> $fdescription \r\n\r\n File sender --> $sender_name"
- } else {
- set message "This is a brief of the conversations during the $frequency: \r\n\r\n Room name --> $name \r\n\r\n Community name --> $comm_name \r\n\r\n Description --> $description \r\n\r\n Creator --> $first_names $last_name \r\n\r\n Keywords --> $keysw \r\n\r\n Partitipants --> $partitipants \r\n\r\n Registered users --> $registered_users \r\n\r\n File Title--> "
- }
- set message_type "text"
-
- bulk_mail::new \
- -package_id $package_id \
- -send_date [template::util::date::get_property linear_date $send_date] \
- -date_format "YYYY MM DD HH24 MI SS" \
- -from_addr $from \
- -subject "\[$community_name\] $subject" \
- -message $message \
- -message_type $message_type \
- -query $query \
- } if_no_rows {
-
}
-
-}
-
-ad_proc -public chat_send_mails_monthly {
- room_id
- community_id
- user_id
- package_id
- week
- frequency
-} {
- Send mails to the registered users with the brief of the chat room conversation
-} {
- if { $week eq "4"} {
-
-
-
- set sende_first_names ""
- set sender_last_name ""
- set sender_email ""
- db_foreach room_info "select user_id as user_id from chat_registered_users where chat_registered_users.room_id = :room_id" {
-
- set sender_id $user_id
-
- db_1row select_sender_info {
-
- select parties.email as sender_email,
- persons.first_names as sender_first_names,
- persons.last_name as sender_last_name
- from parties,persons
- where parties.party_id = :sender_id
- and persons.person_id = :sender_id
- }
-
- db_1row query {
- select parties.email as email
- from dotlrn_member_rels_full,parties
- where dotlrn_member_rels_full.community_id = :community_id
- and parties.party_id = dotlrn_member_rels_full.user_id
- and parties.party_id = :user_id
- }
-
-
-
- set from $sender_email
-
-
- if { $community_id eq "" } {
- set community_name "All Dotlrn communities"
- set community_url "Dotlrn"
- set safe_community_name [db_quote $community_name]
- append who_will_receive_this_clause [db_map recipients_clause]
- set query [db_map sender_info]
-
- } else {
- set community_name [dotlrn_community::get_community_name_not_cached $community_id]
- set community_url "[ad_parameter -package_id [ad_acs_kernel_id] SystemURL][dotlrn_community::get_community_url $community_id]"
- set safe_community_name [db_quote $community_name]
- append who_will_receive_this_clause [db_map recipients_clause]
-
- set query [db_map sender_info4]
-
- }
-
-
- set send_date [template::util::date::now_min_interval]
-
- db_1row room_info {
- select r.pretty_name as name,r.comm_name as comm_name,r.description as description,p.first_names as first_names, p.last_name as last_name
- from chat_rooms as r, persons as p
- where r.room_id = :room_id
- and p.person_id = r.creator
- }
- db_1row room_info2 { select count(fs.title) as count
- from chat_rooms as r, chat_rooms_files_sent as fs
- where r.room_id = :room_id
- and r.room_id = fs.room_id }
-
- if { $count > 0 } {
- db_1row room_info2 { select fs.title as file_name, fs.description as fdescription
- from chat_rooms as r, chat_rooms_files_sent as fs
- where r.room_id = :room_id
- and r.room_id = fs.room_id }
- }
- set partitipants ""
-
- db_foreach rss_partitipants "select distinct persons.first_names as first_names, persons.last_name as last_name
- from chat_msgs as msg,persons
- where msg.room_id = :room_id
- and msg.creation_user = persons.person_id" {
- #append de los participantes
- append partitipants $first_names " "
- append partitipants $last_name " "
- append partitipants " |" " "
-
- } if_no_rows {
-
- set partitipants "There are not partitipants"
- }
-
-
- if { [string index $partitipants [expr [string length $partitipants]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $partitipants]-3]
-
- set partitipants [string range $partitipants $inicio $final]
-
- }
-
- set registered_users ""
- db_foreach rss_registered "select distinct registered.alias as users
- from chat_registered_users as registered
- where registered.room_id = :room_id" {
- #append de los participantes
- append registered_users $users " | "
- } if_no_rows {
-
- set registered_users "There are not registered users"
- }
-
-
-
- if { [string index $registered_users [expr [string length $registered_users]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $registered_users]-3]
- set registered_users [string range $registered_users $inicio $final]
- #set registered_users [string range 0 [expr [string length $registered_users]-3]]
-
- }
-
- set keywords ""
- db_foreach keywords "select k.keyword as key from chat_keywords as k
- where k.room_id = :room_id" {
- #append de las keywords
- append keywords $key " | "
- } if_no_rows {
-
- set keywords "There are not keywords"
- }
- if { [string index $keywords [expr [string length $keywords]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $keywords]-3]
- set registered_users [string range $keywords $inicio $final]
-
- }
-
- set subject "$name conversations brief"
- if { $count > 0 } {
- set message "This is a brief of the conversations during the $frequency: \r\n\r\n Room name --> $name \r\n\r\n Community name --> $comm_name \r\n\r\n Description --> $description \r\n\r\n Creator --> $first_names $last_name \r\n\r\n Keywords --> $keysw \r\n\r\n Partitipants --> $partitipants \r\n\r\n Registered users --> $registered_users \r\n\r\n File Title--> $file_name \r\n\r\n File description --> $fdescription \r\n\r\n File sender --> $sender_name"
- } else {
- set message "This is a brief of the conversations during the $frequency: \r\n\r\n Room name --> $name \r\n\r\n Community name --> $comm_name \r\n\r\n Description --> $description \r\n\r\n Creator --> $first_names $last_name \r\n\r\n Keywords --> $keysw \r\n\r\n Partitipants --> $partitipants \r\n\r\n Registered users --> $registered_users \r\n\r\n File Title--> "
- }
- set message_type "text"
-
- bulk_mail::new \
- -package_id $package_id \
- -send_date [template::util::date::get_property linear_date $send_date] \
- -date_format "YYYY MM DD HH24 MI SS" \
- -from_addr $from \
- -subject "\[$community_name\] $subject" \
- -message $message \
- -message_type $message_type \
- -query $query \
- } if_no_rows {
-
- }
- } else {
- set week [expr $week+1]
- ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 0 15 18] chat_send_mails_monthly $room_id $community_id $user_id $package_id $week
- }
-
-}
-
-
-ad_proc -public chat_message_post2 {
- room_id
- user_id
- alias
- message
- moderator_p
-} {
- Post message to the chat room and broadcast to all applet clients. Used by ajax + html.
-} {
- if {$moderator_p == "1" } {
- set status "approved"
- } else {
- set status "pending"
+ # clear all the messages in the room
+ chat_room_message_delete $room_id
}
-
- set default_client [parameter::get -parameter "DefaultClient" -default "ajax"]
- if {$default_client eq "java"} {
- set chat_msg "[chat_user_name2 $user_id $alias] $user_id $room_id $message$status "
- # Add message to queue. Notify thread responsible for
- # broadcast message to applets.
- nsv_set chat html_message $chat_msg
- ns_mutex unlock [nsv_get chat new_message]
- }
-
- # do not write messages to the database if the room should not be archived
- chat_room_get -room_id $room_id -array room_info
- if { $room_info(archive_p) eq "f" } { return }
-
- # write message to the database
- if {[catch {chat_post_message_to_db -creation_user $user_id $room_id $message} errmsg]} {
- ns_log error "chat_post_message_to_db: error: $errmsg"
- }
}
-ad_proc -public chat_user_name2 {
- user_id
- alias
-} {
- Return display name of this user to use in chat.
-} {
- acs_user::get -user_id $user_id -array user
- set name [expr {$alias ne "" ? $alias : $alias}]
- return $name
-
-}
-
-ad_proc -public chat_room_delete_registered_users {
- room_id
- user_id
-} {
- Delete the registered users in a room.
-} {
- db_exec_plsql delete_users {}
-}
-
-#pablomp
-
-ad_proc -private send_file {
- chat_id
- file
- title
- description
- date
- context_id
- creation_user
- creation_ip
- send_file_id
-} {
-
-
- db_exec_plsql send_file {}
-
- }
-
-
-ad_proc -private send_file_message {
- chat_id
-} {
-
- db_exec_plsql send_file_message {}
-
- }
-
-
-
-
-
-
-
-ad_proc -private chat__rss_datasource {
-summary_context_id
-} {
- This procedure implements the "datasource" operation of the
- RssGenerationSubscriber service contract.
-
- @author Dave Bauer (dave@thedesignexperience.org) and Pablo Mu�oz (pablomp@tid.es)
-} {
-
-
- set limit 15
- set items [list]
-
- db_1row room_info {
- select r.context_id as package_id
- from chat_rooms r
- where r.room_id = :summary_context_id
- }
-
- set package_url [chat_util_get_url $package_id]
- set content "RSS in the chat"
- set column_array(channel_lastBuildDate) ""
- set items ""
-
- db_foreach get_chat_items {} {
- #set entry_url [export_vars -base "[ad_url]${package_url}chat?[export_vars -url {{room_id $summary_context_id}}]"]
- set entry_url [export_vars -base "[ad_url]${package_url}chat?room_id=$summary_context_id"]
-
- set content_as_text [ad_html_text_convert -from "text/plain" -to text/plain -- $content]
- # for now, support only full content in feed
- set description $content_as_text
-
- # Always convert timestamp to GMT
- set entry_date_ansi [lc_time_tz_convert -from [lang::system::timezone] -to "Etc/GMT" -time_value $last_modified]
- #set entry_timestamp "[clock format [clock scan $entry_date_ansi] -format "%a, %d %b %Y %H:%M:%S"] GMT"
- set entry_timestamp "[clock format [clock scan $entry_date_ansi] -format "%Y-%m-%d %H:%M:%S"] GMT"
-
- set items [rss_generation $summary_context_id $entry_url $content_as_text $entry_timestamp]
-
- # set the lastbuilddate just once
- expr { [string eq $column_array(channel_lastBuildDate) ""] ? [set column_array(channel_lastBuildDate) $entry_timestamp] : [set column_array(channel_lastBuildDate) ""] }
- }
- set column_array(channel_title) "RSS Chat"
- set column_array(channel_description) "RSS Chat"
- set column_array(items) $items
- set column_array(channel_language) ""
- set column_array(channel_copyright) ""
- set column_array(channel_managingEditor) ""
- set column_array(channel_webMaster) ""
- set column_array(channel_rating) ""
- set column_array(channel_skipDays) ""
- set column_array(channel_skipHours) ""
- set column_array(version) 2.0
- set column_array(image) ""
- set column_array(channel_link) $entry_url
-
- return [array get column_array]
-}
-
-ad_proc -private chat::rss::create_rss_gen_subscr_impl {} {
-} {
- set spec {
- name "chat_rss"
- aliases {
- datasource chat__rss_datasource
- lastUpdated chat_update_rss
- }
- contract_name "RssGenerationSubscriber"
- owner "chat"
- }
- acs_sc::impl::new_from_spec -spec $spec
-}
-
-ad_proc chat_util_get_url {
- package_id
-} {
- @author Pablo Mu�oz
-} {
-
- set url_stub ""
-
- db_0or1row get_url_stub "
- select site_node__url(node_id) as url_stub
- from site_nodes
- where object_id=:package_id
- "
-
- return $url_stub
-
-}
-
-ad_proc -private chat_update_rss_monthly {
-summary_context_id
-week
-} {
- Returns the time that the last chat room was modified,
- in Unix time. Returns 0 otherwise.
-
- @author PabloMP (pablomp@tid.es)
-} {
- if { $week eq "4" } {
- [chat_update_rss $summary_context_id]
- } else {
- set week [expr $week+1]
- ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 0 15 18] [chat_update_rss_monthly $room_id $week]
- }
-
-}
-
-
-ad_proc -private chat_update_rss {
-summary_context_id
-} {
- Returns the time that the last chat room was modified,
- in Unix time. Returns 0 otherwise.
-
- @author PabloMP (pablomp@tid.es)
-} {
-
-
-
- set subscr_id [rss_support::get_subscr_id \
- -summary_context_id $summary_context_id \
- -impl_name "chat_rss" \
- -owner "chat"]
-
- rss_gen_report $subscr_id
-
-}
-
-
-
-
-
-
-
-ad_proc rss_generation { room_id entry_url content_as_text entry_timestamp } {
- @author Pablo Mu�oz (pablomp@tid.es)
-} {
- set msg_creator ""
- set registered_users ""
- set partitipants ""
- set r_creator ""
-
- db_foreach rss_partitipants {
- select distinct room.pretty_name as room_name,room.frequency1,
- room.creator as room_creator, room.description as room_description,
- room.end_date as end_date
- from chat_rooms as room where room.room_id = :room_id
- } {
- if { ![db_0or1row user_info {
- select r.alias as r_creator
- from chat_registered_users r
- where r.room_id = :room_id
- and r.user_id = :room_creator
- limit 1
- }] } {
- set r_creator [person::name -person_id $room_creator]
- }
-
- }
-
- #regisered users
- set registered_users_list [db_list rss_registered_users {
- select distinct registered.alias as users
- from chat_registered_users as registered
- where registered.room_id = :room_id
- }]
- set registered_users [join $registered_users_list " | "]
-
-# # room participants
-# append registered_users $users " | "
-# #$registered_users
-# if { [string index $registered_users [expr [string length $registered_users]-2]] eq "|" } {
-# set inicio 0
-# set final [expr [string length $registered_users]-4]
-# set registered_users [string range $registered_users $inicio $final]
-
-# }
-
- #comm_name
-
- db_1row room_info {
- select r.comm_name as comm_name
- from chat_rooms r, persons p
- where r.room_id = :room_id
- and p.person_id = r.creator
- }
-
- #Store the values of the new rss in the data base
-
- set rss_id [rss_db $room_name $room_description $end_date $r_creator $comm_name $registered_users $entry_timestamp]
-
- db_1row frequency {
- select r.frequency1
- from chat_rooms r
- where r.room_id = :room_id
- }
-
- switch $frequency1 {
- "dayly" {
- set rss_time [clock format [expr [clock scan $entry_timestamp -gmt "true"]-86400] -format "%D"]
- }
- "weekly" {
- set rss_time [clock format [expr [clock scan $entry_timestamp -gmt "true"]-604800] -format "%D"]
- }
- "monthly" {
- set rss_time [clock format [expr [clock scan $entry_timestamp -gmt "true"]-2592000] -format "%D"]
- }
- }
-
- #partitipants
-
- db_foreach rss_partitipants "select distinct msg.creation_user as msg_creator
- from chat_msgs as msg
- where msg.room_id = :room_id and creation_date >= :rss_time" {
-
- #append de los participantes
- #$msg_creator
- if { $msg_creator eq "-1" } {
- append partitipant "System" ""
- } else {
- db_1row room_info {
- select count(r.alias) as count
- from chat_registered_users r
- where r.room_id = :room_id
- and r.user_id = :msg_creator
- }
-
- if { $count > 0 } {
- db_1row room_info {
- select r.alias as partitipant
- from chat_registered_users r
- where r.room_id = :room_id
- and r.user_id = :msg_creator
- }
- } else {
- db_1row room_info {
- select p.first_names as first_names, p.last_name as last_name
- from persons p
- where p.person_id = :msg_creator
- }
- append msg_creator1 $first_names " "
- append partitipant $msg_creator1 $last_name
- }
- }
-
- set p [store_partitipants_rss $rss_id $partitipant]
- set partitipant ""
-
- #append partitipants $creator " | "
-
- } if_no_rows {
-
- }
-
-
- db_1row room_info {
- select r.comm_name as comm_name
- from chat_rooms r, persons p
- where r.room_id = :room_id
- and p.person_id = r.creator
- }
-
-
- #sent files
-
- db_foreach room_info2 "select fs.send_file_id
- from chat_rooms_files_sent fs
- where fs.room_id = :room_id and date >= :rss_time" {
-
- set s [store_sent_files_rss $rss_id $send_file_id]
- }
-
- #keywords
-
- set keywords ""
- set keysw ""
- db_foreach keywords "select k.keyword as key from chat_keywords k
- where k.room_id = :room_id" {
- #append de las keywords
-
- set k [store_keywords_rss $rss_id $key]
-
- #append keywords $key " | "
- } if_no_rows {
-
- set keywords "There are not keywords"
- }
-
-
- db_1row room_info6 {
- select count(ct.room_id) as count2
- from chat_transcripts ct
- where ct.room_id = :room_id
- }
- set tname ""
- set tdescription ""
- set tdate ""
-
- db_foreach room_info2 "select ct.transcript_id as transcription_id
- from chat_transcripts ct
- where ct.room_id = :room_id and date >= :rss_time" {
- set t [store_transcripts_rss $rss_id $transcription_id]
- }
-
- set rss_data [list]
-
- db_foreach rss_stored "select r.room_name as r_name,r.rss_id,r.creator as r_cre,r.end_date as r_end_date,r.description as r_description,r.comm_name as r_comm_name,r.user_registered as r_user_registered,r.date as entry_timestamp from chat_rss r where r.room_name = :room_name
- and r.creator = :r_creator
- order by entry_timestamp desc" {
-
-
- set keywords ""
- set keysw ""
- db_foreach keywords "select k.key from chat_key_rss k
- where k.rss_id = :rss_id" {
-
- #append de las keywords
- append keywords $key " | "
-
- } if_no_rows {
-
- set keywords "There are not keywords"
- }
- if { [string index $keywords [expr [string length $keywords]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $keywords]-4]
- set keysw [string range $keywords $inicio $final]
- }
-
- set partitipants ""
-
- db_foreach partitipants "select p.partitipant as part from chat_partitipants_rss p
- where p.rss_id = :rss_id" {
-
- #append de las keywords
- append partitipants $part " | "
-
- } if_no_rows {
-
- set partitipants "There are not partitipants"
- }
- #set p_pants "There are not partitipants"
-
- if { [string index $partitipants [expr [string length $partitipants]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $partitipants]-4]
- set p_pants [string range $partitipants $inicio $final]
- } else {
- set p_pants ""
- }
- set file ""
- set file [list]
- set files ""
-
- db_foreach sent_files "select f.file_id as f_id from chat_files_rss f
- where f.rss_id = :rss_id" {
-
-
- append file $f_id " "
-
-
- } if_no_rows {
-
- set f_name ""
- set f_description ""
- set f_sender ""
- set files "f"
-
- }
-
- set f_name_end ""
- set f_description_end ""
- set f_sender_end ""
- set sender_name1 ""
- set sender_name ""
-
- if { !($files eq "f") } {
- set sender_name1 " "
- set sender_name ""
-
-
- for {set i 0} {$i < [llength $file]} {incr i 1} {
- set f_id [lindex $file $i]
-
- db_1row sf {
- select fs.title as file_name, fs.description as fdescription, fs.creation_user as sender
- from chat_rooms_files_sent fs
- where fs.send_file_id = :f_id
- }
- db_0or1row sf2 {
- select p.first_names as sender_first_names, p.last_name as sender_last_name
- from persons p
- where p.person_id = :sender
- }
- append sender_name1 $sender_first_names " "
- append sender_name $sender_name1 $sender_last_name
- append f_name $file_name " | "
- append f_description $fdescription " | "
- append f_sender $sender_name " | "
- set sender_name1 ""
- set sender_name ""
- }
-
- if { [string index $f_name [expr [string length $f_name]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $f_name]-4]
- set f_name_end [string range $f_name $inicio $final]
-
- set final [expr [string length $f_description]-4]
- set f_description_end [string range $f_description $inicio $final]
-
- set final [expr [string length $f_sender]-4]
- set f_sender_end [string range $f_sender $inicio $final]
- set f_sender ""
- set sender_name1 ""
- set sender_name ""
- }
-
- }
-
-
- set trans ""
- set tname ""
- set tdescription ""
- set tdate ""
- set tname6 ""
- set tname5 ""
- set transcription ""
-
- db_foreach transcripts "select t.transcription_id as t_id from chat_transcription_rss t
- where t.rss_id = :rss_id" {
-
-
- append transcription $t_id " "
-
-
- } if_no_rows {
-
- set trans "f"
- }
-
-
-
-
- if { !($trans eq "f") } {
-
-
- for {set i 0} {$i < [llength $transcription]} {incr i 1} {
- set t_id [lindex $transcription $i]
-
- db_1row sf {
- select ct.pretty_name as tname1, ct.description as tdescription1,ct.date as tdate1
- from chat_transcripts ct
- where ct.transcript_id = :t_id
- }
- if { [string index $tname1 0] eq "#" } {
-
- set inicio 6
- set final [expr [string length $tname1]-13]
- set tname2 [string range $tname1 $inicio $final]
- set tname3 [string range $tname1 [expr $final+2] [string length $tname1]]
- db_1row room_info2 {
- select distinct lm.message as tname4
- from lang_messages lm
- where lm.message_key = :tname2
- }
- set tname6 ""
- set tname5 ""
- append tname5 $tname4 " "
- append tname6 $tname5 $tname3
- append tname $tname6 " | "
- } else {
- append tname $tname1 " | "
- }
- set tname1 ""
- set transcriptname ""
-
- if { [string index $tdescription1 0] eq "#" } {
-
- set inicio 6
- set final [expr [string length $tdescription1]-2]
- set tdescription2 [string range $tdescription1 $inicio $final]
-
- db_1row room_info11 {
- select distinct lm.message as tdescription3
- from lang_messages lm
- where lm.message_key = :tdescription2
- }
-
- append tdescription $tdescription3 " | "
-
- } else {
- if { $tdescription eq "" } {
- append tdescription "No description" " | "
- } else {
- append tdescription $tdescription1 " | "
- }
- }
- set tdescription1 ""
-
-
-
-
- append tdate $tdate1 " | "
- }
- }
- set transcriptname ""
- #le quito la barrita del final
- if { [string index $tname [expr [string length $tname]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $tname]-4]
- set transcriptname [string range $tname $inicio $final]
- }
- set transcriptdescription ""
- #le quito la barrita del final
- if { [string index $tdescription [expr [string length $tdescription]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $tdescription]-4]
- set transcriptdescription [string range $tdescription $inicio $final]
- }
- set transcriptdate ""
- #le quito la barrita del final
- if { [string index $tdate [expr [string length $tdate]-2]] eq "|" } {
- set inicio 0
- set final [expr [string length $tdate]-4]
- set transcriptdate [string range $tdate $inicio $final]
- }
-
- db_1row room_info2 {
- select r.context_id as package_id
- from chat_rooms r
- where r.room_id = :room_id
- }
-
-
- set package_url [chat_util_get_url $package_id]
- set entry_url [export_vars -base "[ad_url]${package_url}chat-transcripts?room_id=$room_id"]
-
- set dat ""
- set dat "#chat.transcript_of_date# "
- append dat [clock format [clock seconds] -format %d.%m.%Y]
-
-
- db_1row room_info2 {
- select cr.frequency1
- from chat_rooms cr
- where cr.room_id = :room_id
- }
- if { $frequency1 eq "dayly" } {
- db_1row room_info2 {
- select count(ct.pretty_name) as trans
- from chat_transcripts ct
- where ct.pretty_name = :dat
- and ct.room_id = :room_id
- }
- if { $trans > 0 } {
- db_1row room_info2 {
- select ct.transcript_id
- from chat_transcripts ct
- where ct.pretty_name = :dat
- and ct.room_id = :room_id
- }
- set entry_url [export_vars -base "[ad_url]${package_url}chat-transcript?room_id=$room_id&transcript_id=$transcript_id"]
- }
- }
-
-
-
-
-
- set rss_data_stored1 [list \
- link $entry_url \
- title "$room_name $entry_timestamp" \
- description "[_ chat.Description]: $r_description
[_ chat.room_creator]: $r_cre
[_ chat.comm_name]: $r_comm_name
[_ chat.reg_users]: $r_user_registered
[_ chat.k_words]: $keysw
[_ chat.partitipants]: $p_pants
[_ chat.files_sent]:
[_ chat.name]: $f_name_end
[_ chat.Description]: $f_description_end
[_ chat.sender]: $f_sender_end [_ chat.transcripton]:
[_ chat.name]: $transcriptname
[_ chat.Description]: $transcriptdescription
[_ chat.date_rss2]: $transcriptdate " \
- value $content_as_text \
- timestamp $entry_timestamp]
- lappend rss_data $rss_data_stored1
-
- set f_name ""
- set f_name_end ""
- set f_description ""
- set f_description_end ""
- set f_sender ""
- set sender_name1 ""
- set sender_name ""
- set f_sender_end ""
- set tname ""
- set trans ""
- set tdescription ""
- set tdate ""
- }
-
- return $rss_data
-
- # set rss [rss_creation $room_id $entry_url $content_as_text $entry_timestamp]
-
- # return $rss
-
-}
-
-# ad_proc rss_creation { room_id entry_url content_as_text entry_timestamp } {
-# @author Pablo Mu�oz (pablomp@tid.es)
-# } {
-# }
-
-ad_proc rss_db {
- room_name
- room_description
- end_date
- r_creator
- comm_name
- registered_users
- entry_timestamp
-} {
- db_exec_plsql rss_db {}
-
-}
-
-ad_proc store_partitipants_rss {
- rss_id
- partitipant
-} {
- db_exec_plsql store_partitipants_rss {}
-
-}
-
-ad_proc store_partitipants_transcript {
- transcript_id
- partitipant
-} {
- db_exec_plsql store_partitipants_transcript {}
-
-}
-
-ad_proc store_sent_files_rss {
- rss_id
- send_file_id
-} {
- db_exec_plsql store_sent_files_rss {}
-
-}
-
-ad_proc store_sent_files_tanscript {
- transcript_id
- f_id
-} {
- db_exec_plsql store_sent_files_tanscript {}
-
-}
-
-ad_proc store_keywords_rss {
- rss_id
- key
-} {
- db_exec_plsql store_keywords_rss {}
-
-}
-
-ad_proc store_transcripts_rss {
- rss_id
- transcription_id
-} {
- db_exec_plsql store_transcripts_rss {}
-
-}
Index: openacs-4/packages/chat/tcl/chat-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/Attic/chat-procs.xql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/tcl/chat-procs.xql 7 Jun 2007 09:14:24 -0000 1.3
+++ openacs-4/packages/chat/tcl/chat-procs.xql 19 Nov 2007 01:14:16 -0000 1.4
@@ -17,14 +17,12 @@
where transcript_id = :transcript_id
-
-
select room_id
from chat_rooms
- where archive_p = 't'
+ where archive_p = 't' and auto_flush_p = 't'
@@ -33,41 +31,10 @@
select msg, creation_user, to_char(creation_date, 'DD.MM.YYYY hh24:mi:ss') as creation_date
from chat_msgs
where room_id = :room_id
- and creation_date >= :time
and msg is not null
order by creation_date
-
-
-
- select msg, creation_user, to_char(creation_date, 'DD.MM.YYYY hh24:mi:ss') as creation_date
- from chat_msgs
- where room_id = :room_id
- and msg is not null
- order by creation_date
-
-
-
-
-
- begin
- perform chat_room__delete_all_msgs(:room_id);
- return 0;
- end;
-
-
-
-
-
- select fs.send_file_id as f_id
- from chat_rooms_files_sent fs
- where room_id = :room_id
- and date >= :time
-
-
-
-
-
+
Index: openacs-4/packages/chat/www/ajax-chat-script.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/ajax-chat-script.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/www/ajax-chat-script.adp 7 Jun 2007 09:14:25 -0000 1.3
+++ openacs-4/packages/chat/www/ajax-chat-script.adp 19 Nov 2007 01:14:16 -0000 1.4
@@ -4,10 +4,9 @@
ichat_form.msg
-
#chat.Log_off#
#chat.Transcript#
-
+#chat.Hml#
@chat_frame;noquote@
Index: openacs-4/packages/chat/www/ajax-chat-script.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/ajax-chat-script.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/chat/www/ajax-chat-script.tcl 21 Jun 2007 11:06:29 -0000 1.5
+++ openacs-4/packages/chat/www/ajax-chat-script.tcl 19 Nov 2007 01:14:16 -0000 1.6
@@ -1,12 +1,12 @@
ad_page_contract {
a tiny chat client
- @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) and Pablo Mu�oz (pablomp@tid.es)
+ @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at)
@creation-date Jan 31, 2006
@cvs-id $Id$
} -query {
- msg:optional
+ msg:optional
}
-set chat_frame [ ::chat::Chat login -chat_id $room_id -folder_id $folder_id]
+set chat_frame [ ::chat::Chat login -chat_id $room_id]
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/chat-transcript-search-2.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/chat-transcript-search-2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/chat-transcript-search-2.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/chat-transcript-search.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/chat-transcripts.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat-transcripts.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/www/chat-transcripts.adp 7 Jun 2007 09:14:25 -0000 1.3
+++ openacs-4/packages/chat/www/chat-transcripts.adp 19 Nov 2007 01:14:16 -0000 1.4
@@ -1,9 +1,9 @@
#chat.Transcripts#
-#chat.transcript_of_room# "@room_name;noquote@"
+#chat.transcripts_of_room# "@room_name;noquote@"
-
+#chat.current_transcript#
Index: openacs-4/packages/chat/www/chat.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat.tcl,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/chat/www/chat.tcl 24 Jun 2007 15:21:19 -0000 1.11
+++ openacs-4/packages/chat/www/chat.tcl 19 Nov 2007 01:14:16 -0000 1.12
@@ -3,7 +3,7 @@
Decide which template to use HTML or AJAX.
- @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
+ @author David Dao (ddao@arsdigita.com)
@creation-date November 22, 2000
@cvs-id $Id$
} {
@@ -29,99 +29,60 @@
ad_return_complaint 1 "[_ chat.Room_not_found]"
}
-set user_id [ad_conn user_id]
-set return_url [ad_return_url]
-db_1row room_info {
- select room.comm_name
- from chat_rooms as room
- where room.room_id = :room_id
-}
-
-set folder_title "$comm_name's Public Files"
-
-set folder_id [db_string count {select object_id
- from acs_objects as acs
- where acs.title = :folder_title} -default ""]
-
-if {$folder_id eq ""} {
- acs_user::get -user_id $user_id -array user
- set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
- set folder_id "$name's Shared Files"
-
- #$folder_id
- db_1row room_info {
- select fs.folder_id as id
- from fs_folders as fs
- where fs.name = :folder_id
- }
- set folder_id $id
-}
-
-
-
set context_bar $room_name
auth::require_login
set user_id [ad_conn user_id]
set read_p [permission::permission_p -object_id $room_id -privilege "chat_read"]
set write_p [permission::permission_p -object_id $room_id -privilege "chat_write"]
set ban_p [permission::permission_p -object_id $room_id -privilege "chat_ban"]
-#set moderate_room_p [chat_room_moderate_p $room_id]
+set moderate_room_p [chat_room_moderate_p $room_id]
+if { $moderate_room_p == "t" } {
+ set moderator_p [permission::permission_p -object_id $room_id -privilege "chat_moderator"]
+} else {
+ # This is an unmoderate room, therefore everyone is a moderator.
+ set moderator_p "1"
+}
-#if { $moderate_room_p eq "t" } {
-# set moderator_p [permission::permission_p -object_id $room_id -privilege "chat_moderator"]
-#} else {
-# # This is an unmoderate room, therefore everyone is a moderator.
-# set moderator_p "1"
-#}
-
if { ($read_p == "0" && $write_p == "0") || ($ban_p == "1") } {
- db_1row room_info {
- select cr.private as private
- from chat_rooms as cr
- where cr.room_id = :room_id
- }
- if { $private eq "f"} {
-
- #Display unauthorize privilege page.
- ad_returnredirect unauthorized
- ad_script_abort
- }
+ #Display unauthorize privilege page.
+ ad_returnredirect unauthorized
+ ad_script_abort
}
# Get chat screen name.
set user_name [chat_user_name $user_id]
# send message to the database
-if { $message ne "" } {
+if { ![empty_string_p $message] } {
chat_message_post $room_id $user_id $message $moderator_p
}
-
# Determine which template to use for html or ajax client
switch $client {
"html" {
set template_use "html-chat"
# forward to ajax if necessary
- if { $message ne "" } {
+ if { ![empty_string_p $message] } {
set session_id [ad_conn session_id]
::chat::Chat c1 -volatile -chat_id $room_id -session_id $session_id
c1 add_msg $message
}
}
- "ajax" {
- set template_use "ajax-chat-script"
+ "ajax" {
+ set template_use "ajax-chat-script"
}
- "java" {
- set template_use "java-chat"
+ "java" {
+ set template_use "java-chat"
- # Get config paramater for applet.
- set width [ad_parameter AppletWidth "" 500]
- set height [ad_parameter AppletHeight "" 400]
+ # Get config paramater for applet.
+ set width [ad_parameter AppletWidth "" 500]
+ set height [ad_parameter AppletHeight "" 400]
- set host [ad_parameter ServerHost "" [ns_config "ns/server/[ns_info server]/module/nssock" Hostname]]
- set port [ad_parameter ServerPort "" 8200]
- }
+ set host [ad_parameter ServerHost "" [ns_config "ns/server/[ns_info server]/module/nssock" Hostname]]
+ set port [ad_parameter ServerPort "" 8200]
+ }
}
+
ad_return_template $template_use
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/html-chat-script-form.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/html-chat-script-form.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/html-chat-script-msg.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/html-chat-script-msg.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/html-chat-script.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/html-chat-script.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/html-chat.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/html-chat.adp,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/chat/www/html-chat.adp 26 Oct 2006 11:11:20 -0000 1.7
+++ openacs-4/packages/chat/www/html-chat.adp 19 Nov 2007 01:14:16 -0000 1.8
@@ -35,5 +35,6 @@
+
Index: openacs-4/packages/chat/www/html-chat.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/html-chat.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/chat/www/html-chat.tcl 24 Jun 2006 14:23:42 -0000 1.2
+++ openacs-4/packages/chat/www/html-chat.tcl 19 Nov 2007 01:14:16 -0000 1.3
@@ -17,7 +17,7 @@
set richclient(msg) "[_ chat.${richclient(short)}_client_msg]"
set richclient(title) "[_ chat.[string totitle $richclient(short)]]"
-if { ($read_p == "0" && $write_p == "0") || ($ban_p == "1") || ($active eq "f") } {
+if { ($read_p == "0" && $write_p == "0") || ($ban_p == "1") || ($active == "f") } {
#Display unauthorize privilege page.
ad_returnredirect unauthorized
ad_script_abort
Index: openacs-4/packages/chat/www/index-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/index-postgresql.xql,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat/www/index-postgresql.xql 24 Jun 2007 15:21:19 -0000 1.4
+++ openacs-4/packages/chat/www/index-postgresql.xql 19 Nov 2007 01:14:16 -0000 1.5
@@ -11,9 +11,6 @@
rm.moderated_p,
rm.active_p,
rm.archive_p,
- rm.open as open,
- rm.private as private,
- rm.comm_name as community,
acs_permission__permission_p(room_id, :user_id, 'chat_room_admin') as admin_p,
acs_permission__permission_p(room_id, :user_id, 'chat_read') as user_p,
(select site_node__url(site_nodes.node_id)
@@ -27,28 +24,5 @@
-
-
- select distinct rm.room_id as room_id,
- rm.pretty_name,
- rm.description,
- rm.moderated_p,
- rm.active_p,
- rm.archive_p,
- rm.private as private,
- rm.open as open,
- rm.comm_name as community,
- acs_permission__permission_p(room_id, :user_id, 'chat_room_admin') as admin_p,
- acs_permission__permission_p(room_id, :user_id, 'chat_read') as user_p,
- (select site_node__url(site_nodes.node_id)
- from site_nodes
- where site_nodes.object_id = obj.context_id) as base_url
- from chat_rooms rm,
- acs_objects obj
- where rm.room_id = obj.object_id
- order by rm.pretty_name
-
-
-
Index: openacs-4/packages/chat/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/index.adp,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/chat/www/index.adp 7 Jun 2007 09:14:25 -0000 1.8
+++ openacs-4/packages/chat/www/index.adp 19 Nov 2007 01:14:16 -0000 1.9
@@ -17,14 +17,9 @@
#chat.There_are_no_rooms_available#
-#chat.Create_a_new_room#
+#chat.Create_a_new_room#
-
-
-
-
-
Index: openacs-4/packages/chat/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/index.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/chat/www/index.tcl 24 Jun 2007 15:21:19 -0000 1.7
+++ openacs-4/packages/chat/www/index.tcl 19 Nov 2007 01:14:16 -0000 1.8
@@ -20,96 +20,21 @@
set room_create_p [permission::permission_p -object_id $package_id -privilege chat_room_create]
set default_client [parameter::get -parameter "DefaultClient" -default "ajax"]
set warning ""
-set path [ad_return_url]
if { $default_client eq "ajax" && ![apm_package_installed_p xotcl-core] } {
set warning "[_ chat.xotcl_missing]"
}
if { $room_create_p } {
- lappend actions "#chat.Create_a_new_room#" room-new "#chat.Create_a_new_room#"
+ lappend actions "#chat.Create_a_new_room#" room-edit "#chat.Create_a_new_room#"
}
-lappend actions "#chat.Search_a_room#" room-search?package_id=[ad_conn package_id] "#chat.Search_a_room#"
-if {[info procs dotlrn_community::get_community_id] eq ""} {
- set community_id ""
-} else {
- set community_id [dotlrn_community::get_community_id]
-}
-
-if { $community_id eq "" } {
- set list 0
-} else {
- set list 1
-}
-
-db_multirow -extend { active_users last_activity rss_exists rss_feed_url2 rss_service admin_professor} rooms rooms_list {} {
+db_multirow -extend { active_users last_activity } rooms rooms_list {} {
set room [::chat::Chat create new -volatile -chat_id $room_id]
set active_users [$room nr_active_users]
set last_activity [$room last_activity]
- set rss_exists [rss_support::subscription_exists -summary_context_id $room_id -impl_name chat_rss]
- set rss_feed_url2 [chat_util_get_url $package_id]/rss/rss.tcl?room_id=$room_id
-
- db_1row room_info {
- select count(cru.rss_service) as counter
- from chat_registered_users cru
- where cru.user_id = :user_id
- and cru.room_id = :room_id
- and cru.rss_service = 'true'
- }
- if { $counter > 0} {
- set rss_service 1
- } else {
- set rss_service 0
- }
- db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
}
-
-db_multirow -extend { active_users last_activity rss_exists rss_feed_url2 rss_service admin_professor} rooms2 rooms_list2 {} {
- set room [::chat::Chat create new -volatile -chat_id $room_id]
- set active_users [$room nr_active_users]
- set last_activity [$room last_activity]
- set rss_exists [rss_support::subscription_exists -summary_context_id $room_id -impl_name chat_rss]
- set rss_feed_url2 [chat_util_get_url $package_id]/rss/rss.tcl?room_id=$room_id
-
- db_1row room_info {
- select count(cru.rss_service) as counter
- from chat_registered_users cru
- where cru.user_id = :user_id
- and cru.room_id = :room_id
- and cru.rss_service = 'true'
- }
- if { $counter > 0} {
- set rss_service 1
- } else {
- set rss_service 0
- }
- db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-}
-
-
-
list::create \
-name "rooms" \
-multirow "rooms" \
@@ -118,78 +43,35 @@
-actions $actions \
-row_pretty_plural [_ chat.rooms] \
-elements {
- open {
- label "#chat.open_room#"
+ active {
+ label "#chat.Active#"
html { align "center" }
display_template {
-
-
+
-
+
-
+
}
- }
- private {
- label "#chat.private_room#"
- html { align "center" }
- display_template {
-
-
-
-
-
-
-
-
-
-
-
- }
}
pretty_name {
label "#chat.Room_name#"
- html { align "center" }
+ html { width 400px }
display_template {
- @rooms.pretty_name@
+ @rooms.pretty_name@ \[#chat.HTML_chat# \]
@rooms.pretty_name@
- @rooms.description@
+ @rooms.description@
}
}
- community {
- label "#chat.community_class#"
- html { align "center"}
- display_template {
-
- @rooms.community@
-
- }
- }
- rss {
- label "#chat.rss#"
- html { align "center" }
- display_template {
-
-
-
- #rss-support.Syndication_Feed#
-
- #chat.no_rss#
-
-
- #chat.no_rss#
-
- }
- }
active_users {
label "#chat.active_users#"
html { style "text-align:center;" }
@@ -201,133 +83,12 @@
actions {
label "#chat.actions#"
display_template {
-
-
- #chat.room_admin#
- #chat.Transcripts#
-
-
- \n#chat.room_change_options#
-
- \n#chat.Transcripts#
-
-
-
- #chat.room_admin#
- #chat.Transcripts#
-
- }
- }
- }
-
-list::create \
- -name "rooms2" \
- -multirow "rooms2" \
- -key room_id \
- -pass_properties {room_create_p} \
- -actions $actions \
- -row_pretty_plural [_ chat.rooms] \
- -elements {
- open {
- label "#chat.open_room#"
- html { align "center" }
- display_template {
-
-
-
-
-
+ #chat.Transcripts#
+
+ #chat.room_admin#
-
-
-
-
-
}
- }
- private {
- label "#chat.private_room#"
- html { align "center" }
- display_template {
-
-
-
-
-
-
-
-
-
-
-
- }
}
- pretty_name {
- label "#chat.Room_name#"
- html { align "center" }
- display_template {
-
- @rooms2.pretty_name@
-
-
- (NO #chat.Active#)
-
- @rooms2.description@
- }
- }
- community {
- label "#chat.community_class#"
- html { align "center"}
- display_template {
-
- @rooms2.community@
-
- }
- }
- rss {
- label "#chat.rss#"
- html { align "center" }
- display_template {
-
-
-
- #rss-support.Syndication_Feed#
-
- #chat.no_rss#
-
-
- #chat.no_rss#
-
- }
- }
- active_users {
- label "#chat.active_users#"
- html { style "text-align:center;" }
- }
- last_activity {
- label "#chat.last_activity#"
- html { style "text-align:center;" }
- }
- actions {
- label "#chat.actions#"
- display_template {
-
-
- #chat.room_admin#
- #chat.Transcripts#
-
-
- \n#chat.room_change_options#
-
- \n#chat.Transcripts#
-
-
-
- #chat.room_admin#
- #chat.Transcripts#
-
- }
- }
}
ad_return_template
Index: openacs-4/packages/chat/www/java-chat.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/java-chat.adp,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/chat/www/java-chat.adp 26 Oct 2006 11:11:20 -0000 1.5
+++ openacs-4/packages/chat/www/java-chat.adp 19 Nov 2007 01:14:16 -0000 1.6
@@ -4,8 +4,8 @@
-
-
+
+
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/logoff.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/logoff.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/logoff2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/logon.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/logon.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/message-delete-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/message-delete-2.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/chat/www/message-delete-2.tcl 7 Jun 2007 09:14:25 -0000 1.6
+++ openacs-4/packages/chat/www/message-delete-2.tcl 19 Nov 2007 01:14:16 -0000 1.7
@@ -2,34 +2,19 @@
ad_page_contract {
Delete messages in the room.
- @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
-
+ @author David Dao (ddao@arsdigita.com)
+ @creation-date January 18, 2001
+ @cvs-id $Id$
} {
room_id:integer,notnull
}
-set user_id [ad_conn user_id]
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-} else {
- permission::require_permission -object_id $room_id -privilege chat_room_delete
-}
+permission::require_permission -object_id $room_id -privilege chat_room_delete
if { [catch {chat_room_message_delete $room_id} errmsg] } {
ad_return_complaint 1 "[_ chat.Delete_messages_failed]: $errmsg"
}
::chat::Chat flush_messages -chat_id $room_id
-ad_returnredirect .
+ad_returnredirect .
\ No newline at end of file
Index: openacs-4/packages/chat/www/message-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/message-delete.adp,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/chat/www/message-delete.adp 21 Jun 2007 11:06:29 -0000 1.7
+++ openacs-4/packages/chat/www/message-delete.adp 19 Nov 2007 01:14:16 -0000 1.8
@@ -9,13 +9,8 @@
@context_bar;noquote@
#chat.Confirm_message_delete#
-
#chat.Are_you_sure_you_want_to_delete# @message_count@ #chat.messages_in# @pretty_name@?
-
-
-#chat.There#
-
\ No newline at end of file
Index: openacs-4/packages/chat/www/message-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/message-delete.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat/www/message-delete.tcl 7 Jun 2007 09:14:25 -0000 1.4
+++ openacs-4/packages/chat/www/message-delete.tcl 19 Nov 2007 01:14:16 -0000 1.5
@@ -2,8 +2,9 @@
ad_page_contract {
Display delete message confirmation.
- @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz (pablomp@tid.es)
-
+ @author David Dao (ddao@arsdigita.com)
+ @creation-date January 18, 2001
+ @cvs-id $Id$
} {
room_id:notnull,integer
} -properties {
@@ -13,23 +14,7 @@
context_bar:onevalue
}
-set user_id [ad_conn user_id]
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-} else {
- ad_require_permission $room_id chat_room_delete
-}
+ad_require_permission $room_id chat_room_delete
set context_bar [list [list "room?room_id=$room_id" "[_ chat.Room_Information]"] "[_ chat.Delete_messages]"]
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/options.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/options.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/options2.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/options2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/private-room.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/private-room.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/room-delete-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-delete-2.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat/www/room-delete-2.tcl 7 Jun 2007 09:14:25 -0000 1.4
+++ openacs-4/packages/chat/www/room-delete-2.tcl 19 Nov 2007 01:14:16 -0000 1.5
@@ -2,30 +2,14 @@
ad_page_contract {
Delete the chat room.
- @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
+ @author David Dao (ddao@arsdigita.com)
@creation-date November 16, 2000
@cvs-id $Id$
} {
room_id:integer,notnull
}
-set user_id [ad_conn user_id]
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-} else {
ad_require_permission $room_id chat_room_delete
-}
if { [catch {chat_room_delete $room_id} errmsg] } {
ad_return_complaint 1 "[_ chat.Delete_room_failed]: $errmsg"
Index: openacs-4/packages/chat/www/room-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-delete.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat/www/room-delete.tcl 7 Jun 2007 09:14:25 -0000 1.4
+++ openacs-4/packages/chat/www/room-delete.tcl 19 Nov 2007 01:14:16 -0000 1.5
@@ -2,8 +2,9 @@
ad_page_contract {
Display delete confirmation.
- @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
-
+ @author David Dao (ddao@arsdigita.com)
+ @creation-date November 15, 2000
+ @cvs-id $Id$
} {
room_id:notnull,integer
} -properties {
@@ -12,25 +13,8 @@
context_bar:onevalue
}
-set user_id [ad_conn user_id]
+ad_require_permission $room_id chat_room_delete
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-} else {
- ad_require_permission $room_id chat_room_delete
-}
-
set context_bar [list [list "room?room_id=$room_id" "[_ chat.Room_Information]"] "[_ chat.Delete_room]"]
set pretty_name [chat_room_name $room_id]
Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-edit-2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-edit.postgresql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/room-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-edit.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/chat/www/room-edit.tcl 6 Jul 2007 12:13:23 -0000 1.8
+++ openacs-4/packages/chat/www/room-edit.tcl 19 Nov 2007 01:14:16 -0000 1.9
@@ -2,223 +2,96 @@
ad_page_contract {
Display a form to edit room information.
- @author Peter Alberer (peter@alberer.com) and Pablo Mu�oz(pablomp@tid.es)
+ @author Peter Alberer (peter@alberer.com)
+ @creation-date March 26, 2006
} {
room_id:integer,optional
}
-set user_id [ad_conn user_id]
+permission::require_permission -object_id [ad_conn package_id] -privilege chat_room_edit
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-
-} else {
- permission::require_permission -object_id [ad_conn package_id] -privilege chat_room_edit
-}
-
if { ![info exists room_id] } {
set title "[_ chat.Create_a_new_room]"
} else {
set title "[_ chat.Edit_room] \"[chat_room_name $room_id]\""
}
-set user_id [ad_conn user_id]
-
-
-db_1row room_info {
- select rm.room_id,
- rm.pretty_name as pretty_name,
- rm.frequency1,
- rm.description as description,
- rm.moderated_p as moderated,
- rm.maximal_participants as max_p,
- rm.active_p as active_p,
- rm.archive_p as archive_p,
- to_char(rm.end_date,'YYYY-MM-DD HH24:MI:SS') as end_date_ansi,
- (select ru.alias
- from chat_registered_users ru
- where rm.room_id = ru.room_id
- and ru.user_id = :user_id) as alias,
- (select ru.RSS_service
- from chat_registered_users ru
- where rm.room_id = ru.room_id
- and ru.user_id = :user_id) as rss_service,
- (select ru.mail_service
- from chat_registered_users ru
- where rm.room_id = ru.room_id
- and ru.user_id = :user_id) as mail_service,
- (select ru.frequency_mail
- from chat_registered_users ru
- where rm.room_id = ru.room_id
- and ru.user_id = :user_id) as frequency2
- from chat_rooms rm
- where rm.room_id = :room_id
-}
-
-set key_words ""
-db_foreach room_info "select ck.keyword as key from chat_keywords ck where ck.room_id = :room_id" {
- append key_words $key " "
-}
-
-set rss_active $rss_service
-set frequency1_rss $frequency1
-set end_date [template::util::date::from_ansi $end_date_ansi "YYYY-MM-DD HH24:MI:SS"]
-set frequency_active $frequency2
-
ad_form -name "edit-room" -edit_buttons [list [list [_ chat.Update_room] next]] -has_edit 1 -form {
- {room_id:key}
+ {room_id:key}
+ {moderated_p:boolean(hidden)
+ {value "f"}
+ }
{pretty_name:text(text)
{label "#chat.Room_name#" }
- {title "Name of the room"}
}
- {alias:text(text)
- {label "#chat.alias#" }
- {help_text "[_ chat.alias_in_this_room]"}
- }
{description:text(textarea),optional
{label "#chat.Description#" }
{html {rows 6 cols 65}}
}
- {key_words:text(textarea),optional
- {label "#chat.keywords#" }
- {html {rows 3 cols 25}}
- {help_text "[_ chat.main_words]"}
- }
- {max_p:text(text)
- {label "#chat.maximal_partitipants#" }
- {help_text "[_ chat.maximal_number_partitipants]"}
- }
- {end_date:date(date)
- {label "#chat.end_date#" }
- {help_text "[_ chat.end_date_description]"}
- }
- {rss_service:boolean(radio)
- {label "#chat.rss_service#" }
- {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_No#" f}}}
- {help_text "[_ chat.rss_syndication]"}
- }
- {frequency1:text(select),optional
- {label "#chat.frequency_rss#" }
- {options {{"dayly" dayly} {"weekly" weekly} {"monthly" monthly} }}
- {help_text "[_ chat.frequency_rss_description]"}
- }
- {mail_service:boolean(radio)
- {label "#chat.mail_service#" }
- {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_No#" f}}}
- {help_text "[_ chat.receive_mails]"}
- }
- {frequency2:text(select),optional
- {label "#chat.frequency_mail#" }
- {options {{"daily" dayly} {"weekly" weekly} {"monthly" monthly} }}
- {help_text "[_ chat.frequency_mail_description]"}
- }
- # {moderated:boolean(radio)
- # {label "#chat.Moderated#" }
- # {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_No#" f}}}
- # }
{active_p:boolean(radio)
{label "#chat.Active#" }
- {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_No#" f}}}
+ {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
+ {value "t"}
}
{archive_p:boolean(radio)
{label "#chat.Archive#" }
- {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_No#" f}}}
+ {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
+ {value "t"}
}
-# {auto_flush_p:boolean(radio)
- # {label "#chat.AutoFlush#" }
- # {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_No#" f}}}
- # {help_text "[_ chat.AutoFlushHelp]"}
- # }
- # {auto_transcript_p:boolean(radio)
- # {label "#chat.AutoTranscript#" }
- # {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_No#" f}}}
- # {help_text "[_ chat.AutoTranscriptHelp]"}
- # }
-} -edit_request {
-
-} -edit_data {
-
-} -after_submit {
- #$rss_active
- set date [lrange $end_date 0 2]
- set community_id [dotlrn_community::get_community_id]
- if { $community_id eq "" } {
- set comm_id 0
- }
- set package_id [ad_conn package_id]
-
- if {[catch {set room_edit [chat_room_edit \
- -alias $alias \
- -key_words $key_words \
- -maxP $max_p \
- -end_date $date \
- -Rss_service $rss_service \
- -frequency1 $frequency1 \
- -frequency_mail $frequency2 \
- -Mail_service $mail_service \
- -moderated_p $moderated \
+ {auto_flush_p:boolean(radio)
+ {label "#chat.AutoFlush#" }
+ {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
+ {value "t"}
+ {help_text "[_ chat.AutoFlushHelp]"}
+ }
+ {auto_transcript_p:boolean(radio)
+ {label "#chat.AutoTranscript#" }
+ {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
+ {value "f"}
+ {help_text "[_ chat.AutoTranscriptHelp]"}
+ }
+} -new_data {
+ if {[catch {set room_id [chat_room_new -moderated_p $moderated_p \
+ -description $description \
-active_p $active_p \
-archive_p $archive_p \
- -user_id [ad_conn user_id] \
- -room_id $room_id \
- $description $pretty_name]} errmsg]} {
-
+ -auto_flush_p $auto_flush_p \
+ -auto_transcript_p $auto_transcript_p \
+ -context_id [ad_conn package_id] \
+ -creation_user [ad_conn user_id] \
+ -creation_ip [ad_conn peeraddr] $pretty_name]} errmsg]} {
ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg"
break
}
-
- if { $mail_service eq "t" && ![string eq $frequency_active $frequency2]} {
-
- if { $frequency2 eq "dayly" } {
- ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 01 00] chat_send_mails $room_id $community_id $user_id $package_id "daily"
- }
- if { $frequency2 eq "weekly" } {
- ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 0 01 00] chat_send_mails $room_id $community_id $user_id $package_id "weekly"
- }
- if { $frequency2 eq "monthly" } {
- set week 1
- ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 0 01 00] chat_send_mails_monthly $room_id $community_id $user_id $package_id $week "monthly"
- }
- }
-
- if { $rss_service eq "t" } {
- if { $rss_active eq "f"} {
- #ad_returnredirect "rss?room_id=$room_id"
-
- if { $frequency1_rss eq $frequency1} {
- } else {
- #if the rss exists, only create a thread with the schedule
- if { [rss_support::subscription_exists \
- -summary_context_id $room_id \
- -impl_name chat_rss] } {
-
-
- if { $frequency1 eq "dayly" } {
- ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 00 10] [chat_update_rss $room_id]
- }
- if { $frequency1 eq "weekly" } {
- ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 0 00 10] [chat_update_rss $room_id]
- }
- if { $frequency1 eq "monthly" } {
- set week 1
- ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 0 00 10] [chat_update_rss_monthly $room_id $week]
- }
- }
- }
-
- }
- }
+ set comm_id ""
+ if {[info command dotlrn_community::get_community_id] ne ""} {
+ set comm_id [dotlrn_community::get_community_id]
+ }
+ if {$comm_id ne ""} {
+ chat_user_grant $room_id $comm_id
+ } else {
+ #-2 Registered Users
+ #chat_user_grant $room_id -2
+ #0 Unregistered Visitor
+ #chat_user_grant $room_id 0
+ #-1 The Public
+ chat_user_grant $room_id -2
+ }
+} -edit_request {
+ if {[catch {db_1row room_info {
+ select pretty_name, description, moderated_p, archive_p, active_p, auto_flush_p, auto_transcript_p
+ from chat_rooms
+ where room_id = :room_id}} errmsg]} {
+ ad_return_complaint 1 "[_ chat.Room_not_found]."
+ break
+ }
+} -edit_data {
+ if {[catch {chat_room_edit $room_id $pretty_name $description $moderated_p $active_p $archive_p $auto_flush_p $auto_transcript_p} errmsg]} {
+ ad_return_complaint 1 "[_ chat.Could_not_update_room]: $errmsg"
+ break
+ }
+ util_memoize_flush [list chat_room_get_not_cached $room_id]
+} -after_submit {
ad_returnredirect "room?room_id=$room_id"
ad_script_abort
}
Index: openacs-4/packages/chat/www/room-enter.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-enter.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/chat/www/room-enter.tcl 7 Jun 2007 09:14:25 -0000 1.6
+++ openacs-4/packages/chat/www/room-enter.tcl 19 Nov 2007 01:14:16 -0000 1.7
@@ -9,7 +9,6 @@
} {
room_id:integer,notnull
client:trim
-
}
set user_id [ad_conn user_id]
@@ -20,7 +19,7 @@
ns_log notice "--query ban $ban_p: permission::permission_p -object_id $room_id -privilege chat_ban -party_id [ad_conn user_id]"
set active [room_active_status $room_id]
-if { ($read_p == "0" && $write_p == "0") || ($ban_p == "1") || ($active eq "f") } {
+if { ($read_p == "0" && $write_p == "0") || ($ban_p == "1") || ($active == "f") } {
#Display unauthorize privilege page.
ad_returnredirect unauthorized
ad_script_abort
@@ -31,13 +30,12 @@
if {$default_client eq "java"} {
chat_start_server
}
+
switch $client {
- "html" - "ajax" - "html-chat-script" {
- ns_log Notice "YY room-enter: has_entered_the room"
- chat_message_post $room_id $user_id "[_ chat.has_entered_the_room]." "1"
- }
+ "html" - "ajax" - "html-chat-script" {
+ ns_log Notice "YY room-enter: has_entered_the room"
+ chat_message_post $room_id $user_id "[_ chat.has_entered_the_room]." "1"
+ }
}
-
-
ad_returnredirect "chat?room_id=$room_id&client=$client"
Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-entry.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-new-2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-new-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.9 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-new.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-search-2.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-search-2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-search.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-search.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/room.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room.adp,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/chat/www/room.adp 26 Oct 2006 11:11:20 -0000 1.7
+++ openacs-4/packages/chat/www/room.adp 19 Nov 2007 01:14:16 -0000 1.8
@@ -28,9 +28,15 @@
#chat.Archive#
@archive_p@
-
-
+ #chat.AutoFlush#
+ @auto_flush_p@
+
+
+ #chat.AutoTranscript#
+ @auto_transcript_p@
+
+
#chat.message_count#
@message_count@
Index: openacs-4/packages/chat/www/room.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/chat/www/room.tcl 7 Jun 2007 09:14:25 -0000 1.6
+++ openacs-4/packages/chat/www/room.tcl 19 Nov 2007 01:14:16 -0000 1.7
@@ -1,8 +1,9 @@
#/www/chat/room.tcl
ad_page_contract {
Display information about chat room.
- @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
-
+ @author David Dao (ddao@arsdigita.com)
+ @creation-date November 15, 2000
+ @cvs-id $Id$
} {
room_id:integer,notnull
} -properties {
@@ -31,32 +32,7 @@
}
set context_bar [list "[_ chat.Room_Information]"]
-set user_id [ad_conn user_id]
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-set room_view_p 1
-set room_edit_p 1
-set room_delete_p 1
-set user_ban_p 1
-set user_unban_p 1
-set user_grant_p 1
-set user_revoke_p 1
-#set moderator_grant_p 1
-#set moderator_revoke_p 1
-set transcript_create_p 1
-} else {
###
# Get all available permission of this user on this room.
###
@@ -67,15 +43,15 @@
set user_unban_p [permission::permission_p -object_id $room_id -privilege chat_user_unban]
set user_grant_p [permission::permission_p -object_id $room_id -privilege chat_user_grant]
set user_revoke_p [permission::permission_p -object_id $room_id -privilege chat_user_revoke]
-#set moderator_grant_p [permission::permission_p -object_id $room_id -privilege chat_moderator_grant]
-#set moderator_revoke_p [permission::permission_p -object_id $room_id -privilege chat_moderator_revoke]
+set moderator_grant_p [permission::permission_p -object_id $room_id -privilege chat_moderator_grant]
+set moderator_revoke_p [permission::permission_p -object_id $room_id -privilege chat_moderator_revoke]
set transcript_create_p [permission::permission_p -object_id $room_id -privilege chat_transcript_create]
-}
+
###
# Get room basic information.
###
db_1row room_info {
- select pretty_name, description, moderated_p, active_p, archive_p
+ select pretty_name, description, moderated_p, active_p, archive_p, auto_flush_p, auto_transcript_p
from chat_rooms
where room_id = :room_id
}
Index: openacs-4/packages/chat/www/search-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/search-2.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/chat/www/search-2.tcl 24 Jun 2006 14:23:42 -0000 1.2
+++ openacs-4/packages/chat/www/search-2.tcl 19 Nov 2007 01:14:16 -0000 1.3
@@ -27,27 +27,27 @@
set context [list [list "./" "Users"] "Search"]
-if {[info exists keyword]} {
+if [info exists keyword] {
# this is an administrator
- if { $keyword eq "" } {
+ if { [empty_string_p $keyword] } {
incr exception_count
append exception_text "You forgot to type a search string!\n"
}
} else {
# from one of the user pages
- if { (![info exists email] || $email eq "") && \
- (![info exists last_name] || $last_name eq "") } {
+ if { (![info exists email] || [empty_string_p $email]) && \
+ (![info exists last_name] || [empty_string_p $last_name]) } {
incr exception_count
append exception_text " You must specify either an email address or last name to search for.\n"
}
if { [info exists email] && [info exists last_name] && \
- $email ne "" && $last_name ne "" } {
+ ![empty_string_p $email] && ![empty_string_p $last_name] } {
incr exception_count
append exception_text " You can only specify either email or last name, not both.\n"
}
- if { ![info exists target] || $target eq "" } {
+ if { ![info exists target] || [empty_string_p $target] } {
incr exception_count
append exception_text " Target was not specified. This shouldn't have happened,
please contact the administrator
@@ -68,7 +68,7 @@
set search_type "keyword"
set sql_keyword "%[string tolower $keyword]%"
lappend where_clause "(username like :sql_keyword or email like :sql_keyword or lower(first_names || ' ' || last_name) like :sql_keyword)"
-} elseif { [info exists email] && $email ne "" } {
+} elseif { [info exists email] && ![empty_string_p $email] } {
set search_type "email"
set sql_email "%[string tolower $email]%"
lappend where_clause "email like :sql_email"
@@ -124,7 +124,7 @@
set user_search:[set rowcount](member_state) $member_state
- if { $member_state ne "approved" } {
+ if { $member_state != "approved" } {
set user_search:[set rowcount](user_finite_state_links) [join [ad_registration_finite_state_machine_admin_links $member_state $email_verified_p $user_id_from_search "search?[export_url_vars email last_name keyword target passthrough limit_users_in_group_id only_authorized_p]"] " | "]
} else {
set user_search:[set rowcount](user_finite_state_links) ""
Index: openacs-4/packages/chat/www/search-3.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/search-3.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/www/search-3.tcl 7 Jun 2007 09:14:25 -0000 1.3
+++ openacs-4/packages/chat/www/search-3.tcl 19 Nov 2007 01:14:16 -0000 1.4
@@ -1,55 +1,16 @@
ad_page_contract {
-@author Pablo Mu�oz(@pablomp@tid.es)
} {
type:notnull
room_id:integer,notnull
party_id:integer,notnull
}
-
if {$type eq "user"} {
-
-set user_id [ad_conn user_id]
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-} else {
ad_require_permission $room_id chat_user_grant
-}
chat_user_grant $room_id $party_id
} else {
-
-set user_id [ad_conn user_id]
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-
-if { $admin_professor eq "t"} {
-
-} else {
-
-ad_require_permission $room_id chat_user_ban
-}
+ ad_require_permission $room_id chat_user_ban
chat_user_ban $room_id $party_id
}
ad_returnredirect "room?room_id=$room_id"
Index: openacs-4/packages/chat/www/transcript-edit-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-edit-2.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/chat/www/transcript-edit-2.tcl 7 Jun 2007 09:14:25 -0000 1.6
+++ openacs-4/packages/chat/www/transcript-edit-2.tcl 19 Nov 2007 01:14:16 -0000 1.7
@@ -11,7 +11,6 @@
contents:html,notnull
room_id:notnull,integer
{description:trim ""}
- {keywords:trim ""}
}
permission::require_permission -object_id $transcript_id -privilege chat_transcript_edit
@@ -20,4 +19,4 @@
ad_return_complaint 1 "[_ chat.Could_not_update_transcript]: $errmsg"
}
-ad_returnredirect "transcript-view?transcript_id=$transcript_id&room_id=$room_id"
+ad_returnredirect "transcript-view?transcript_id=$transcript_id&room_id=$room_id"
\ No newline at end of file
Index: openacs-4/packages/chat/www/transcript-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-edit.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/chat/www/transcript-edit.tcl 7 Jun 2007 09:14:25 -0000 1.5
+++ openacs-4/packages/chat/www/transcript-edit.tcl 19 Nov 2007 01:14:16 -0000 1.6
@@ -2,8 +2,9 @@
ad_page_contract {
Retrieve transcript content.
- @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
-
+ @author David Dao (ddao@arsdigita.com)
+ @creation-date November 28, 2000
+ @cvs-id $Id$
} {
transcript_id:integer,notnull
room_id:integer,notnull
@@ -16,20 +17,11 @@
set active_p [room_active_status $room_id]
db_1row get_transcript_info {
- select ct.pretty_name, ct.description, ct.contents
- from chat_transcripts ct
- where transcript_id = :transcript_id
+ select pretty_name, description, contents
+ from chat_transcripts
+ where transcript_id = :transcript_id
}
-set keywords ""
-db_foreach get_transcript_info2 {
- select ck.keyword as key
- from chat_room_transcript_keywords ck
- where ck.transcript_id = :transcript_id
-} {
- append keywords $key " "
-}
-
ad_form -name "edit-transcription" -edit_buttons [list [list [_ chat.Edit] next]] -has_edit 1 -form {
{room_id:integer(hidden)
{value $room_id}
@@ -46,21 +38,14 @@
{html {rows 6 cols 65}}
{value $description}
}
- {keywords:text(textarea),optional
- {label "#chat.keywords#" }
- {html {rows 6 cols 65}}
- {value $keywords}
- }
{contents:text(textarea)
{label "#chat.Transcript#" }
- {html {rows 3 cols 65}}
+ {html {rows 6 cols 65}}
{value $contents}
}
} -on_submit {
if { [catch {chat_transcript_edit $transcript_id $pretty_name $description $contents} errmsg] } {
ad_return_complaint 1 "[_ chat.Could_not_update_transcript]: $errmsg"
- }
- chat_transcript_edit_keywords $transcript_id $keywords
-
+ }
ad_returnredirect "chat-transcript?transcript_id=$transcript_id&room_id=$room_id"
}
Index: openacs-4/packages/chat/www/transcript-entry.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-entry.adp,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/chat/www/transcript-entry.adp 7 Jun 2007 09:14:25 -0000 1.7
+++ openacs-4/packages/chat/www/transcript-entry.adp 19 Nov 2007 01:14:16 -0000 1.8
@@ -43,10 +43,6 @@
@description@
- #chat.keywords#
- @keywords@
-
-
#chat.Contents#
@contents;noquote@
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/transcript-new-2-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/transcript-new-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-new-2.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/www/transcript-new-2.tcl 7 Jun 2007 09:14:25 -0000 1.3
+++ openacs-4/packages/chat/www/transcript-new-2.tcl 19 Nov 2007 01:14:16 -0000 1.4
@@ -1,12 +1,10 @@
#/chat/www/transcript-new-2.tcl
ad_page_contract {
Save transcript.
- @author Pablo Mu�oz(pablomp@tid.es)
} {
room_id:integer,notnull
transcript_name:trim,notnull
{description:trim ""}
- {keywords:trim ""}
{delete_messages:optional "off"}
{deactivate_room:optional "off"}
contents:trim,notnull,html
@@ -26,15 +24,6 @@
$transcript_name $contents $room_id
]
-#store_transcripts_keywords $keywords transcript_id
-for {set i 0} {$i < [llength $keywords]} {incr i 1} {
- set word [lindex $keywords $i]
- #set k [store_transcripts_keywords $word $transcript_id]
- db_exec_plsql store_transcripts_keywords {}
- }
-
-
-
if { $delete_messages eq "on" } {
chat_room_message_delete $room_id
# forward the information to AJAX
@@ -45,19 +34,5 @@
db_dml "update_chat" "update chat_rooms set active_p = 'f' where room_id = $room_id"
}
-
-
ad_returnredirect "chat-transcript?room_id=$room_id&transcript_id=$transcript_id"
-
-ad_proc store_transcripts_keywords {
- keywords
- transcript_id
-} {
- for {set i 0} {$i < [llength $keywords]} {incr i 1} {
- set word [lindex $keywords $i]
- #set k [store_transcripts_keywords $word $transcript_id]
- db_exec_plsql store_transcripts_keywords {}
- }
-
-}
\ No newline at end of file
Index: openacs-4/packages/chat/www/transcript-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-new.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/chat/www/transcript-new.tcl 7 Jun 2007 09:14:25 -0000 1.5
+++ openacs-4/packages/chat/www/transcript-new.tcl 19 Nov 2007 01:14:16 -0000 1.6
@@ -1,7 +1,6 @@
#/chat/www/transcript-new.tcl
ad_page_contract {
Display available all available chat messages.
- @author Pablo Mu�oz(pablomp@tid.es)
} {
room_id:integer,notnull
} -properties {
@@ -15,23 +14,7 @@
contents:onevalue
}
-set user_id [ad_conn user_id]
-#A professor who creates a rooom will be able to admin it.
-db_1row room_info2 {
- select count(cr.creator) as counter2
- from chat_rooms cr
- where cr.room_id = :room_id
- and cr.creator = :user_id
- }
- if { $counter2 > 0} {
- set admin_professor "t"
- } else {
- set admin_professor "f"
- }
-if { $admin_professor eq "t"} {
-} else {
permission::require_permission -object_id $room_id -privilege chat_transcript_create
-}
set context_bar [list [list "room?room_id=$room_id" "[_ chat.Room_Information]"] "[_ chat.Create_transcript]"]
@@ -43,35 +26,10 @@
set title "[_ chat.Create_transcript]"
set submit_label "[_ chat.Create_transcript]"
set active_p [room_active_status $room_id]
-set keywords ""
-
-
#Build a list of all message.
db_foreach get_archives_messages {} {
-
- if { $creation_user eq "-1" } {
- append contents "\[$creation_date\] System : $msg \n"
- } else {
- db_1row room_info2 {
- select count(r.alias)
- from chat_registered_users r
- where r.user_id = :creation_user
- and r.room_id = :room_id
- }
-
- if { $count > 0} {
- db_1row room_info2 {
- select r.alias
- from chat_registered_users r
- where r.user_id = :creation_user
- and r.room_id = :room_id
- }
- append contents "\[$creation_date\] [chat_user_name2 $creation_user $alias] : $msg \n"
- } else {
- append contents "\[$creation_date\] [chat_user_name $creation_user] : $msg \n"
- }
- }
+ append contents "\[$creation_date\] [chat_user_name $creation_user] : $msg \n"
}
ad_return_template "transcript-entry"
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/transcript-search.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/upload.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/upload.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/user-grant-2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/user-grant-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/user-grant.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/user-revoke-2.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/user-revoke-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/user-revoke.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/user-revoke.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/admin/rss.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/ajax/chat.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/ajax/Attic/chat.js,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/www/ajax/chat.js 7 Jun 2007 09:14:25 -0000 1.3
+++ openacs-4/packages/chat/www/ajax/chat.js 19 Nov 2007 01:14:17 -0000 1.4
@@ -51,7 +51,7 @@
if (node.childNodes[i].nodeType == 3 ) {
// if this is a textnode, skip it
continue;
- }
+ }
msgCount++;
p = doc.createElement('p');
p.className = 'line';
@@ -80,144 +80,68 @@
}
function pushReceiver(content) {
- //alert(content);
- updateReceiver(content);
+ updateReceiver(content);
var msgField = document.getElementById('chatMsg');
msgField.value = '';
msgField.disabled = false;
msgField.focus();
}
function updateReceiver(content) {
- // alert(content);
var xmlobject = (new DOMParser()).parseFromString(content, 'application/xhtml+xml');
var body = xmlobject.getElementsByTagName('body');
- //alert(content);
- for (var i = 0 ; i < body[0].childNodes.length ; i++) {
+ for (var i = 0 ; i < body[0].childNodes.length ; i++) {
if (body[0].childNodes[i].nodeType == 3 ) {
// if this is a textnode, skip it
continue;
}
-
var attribute = body[0].childNodes[i].getAttribute('id');
-
switch (attribute) {
case "messages":
- var messagesNode = body[0].childNodes[i];
+ var messagesNode = body[0].childNodes[i];
if (messagesNode.hasChildNodes()) {
- var messagesDoc = frames['ichat'].document; //esto es lo actual de mi pagina
- var messagesDiv = frames['ichat'].document.getElementById('messages'); //actual de mi pagina
- messagesReceiver(messagesNode,messagesDoc,messagesDiv);//con todos los elemtnos nuevos en messagesNode, el documento messagesDco y la capa exacta, creare una nueva capa y sustituyo en el documento la que tengo por la nueva
+ var messagesDoc = frames['ichat'].document;
+ var messagesDiv = frames['ichat'].document.getElementById('messages');
+ messagesReceiver(messagesNode,messagesDoc,messagesDiv);
}
break;
- case "users":
- var usersNode = body[0].childNodes[i].childNodes[0];
-
+ case "users":
+ var usersNode = body[0].childNodes[i].childNodes[0];
var usersDoc = frames['ichat-users'].document;
-
var usersTbody = frames['ichat-users'].document.getElementById('users').tBodies[0];
-
usersReceiver(usersNode,usersDoc,usersTbody);
break;
- case "files":
- var filesNode = body[0].childNodes[i].childNodes[0];
- var filesDoc = frames['ichat-files'].document;
- var filesTbody = frames['ichat-files'].document.getElementById('files').tBodies[0];
- filesReceiver(filesNode,filesDoc,filesTbody);
- break;
}
}
-
-
-
-
}
function usersReceiver(node,doc,tbody) {
var tr, td, e, s, nbody;
-
-
nbody = doc.createElement('tbody');
for (var i = 0 ; i < node.childNodes.length ; i++) {
if (node.childNodes[i].nodeType == 3 ){
// if this is a textnode, skip it
continue;
}
-
tr = doc.createElement('tr');
- e = node.childNodes[i].getElementsByTagName('td');
+ e = node.childNodes[i].getElementsByTagName('TD');
-
td = doc.createElement('td');
- var ref = e[0].firstChild.getAttribute('href');
- var ref2 = e[0].firstChild.firstChild.getAttribute('src');
- var aux = " ";
- var aux2 = ""+aux+" ";
- td.innerHTML = decodeURIComponent(aux2);
- tr.appendChild(td);
-
-
-
- td = doc.createElement('td');
- td.innerHTML = decodeURIComponent(e[1].firstChild.nodeValue.replace(/\+/g,' '));
+ td.innerHTML = decodeURIComponent(e[0].firstChild.nodeValue.replace(/\+/g,' '));
td.className = 'user';
- tr.appendChild(td);
-
+ tr.appendChild(td);
td = doc.createElement('td');
- td.innerHTML = decodeURIComponent(e[2].firstChild.nodeValue.replace(/\+/g,' '));
+ td.innerHTML = decodeURIComponent(e[1].firstChild.nodeValue.replace(/\+/g,' '));
td.className = 'timestamp';
- tr.appendChild(td);
+ tr.appendChild(td);
-
nbody.appendChild(tr);
-
}
tbody.parentNode.replaceChild(nbody,tbody);
-
-
}
-function filesReceiver(node,doc,tbody) {
- var tr, td, e, s, nbody;
-
-
- nbody = doc.createElement('tbody');
- for (var i = 0 ; i < node.childNodes.length ; i++) {
- if (node.childNodes[i].nodeType == 3 ){
- // if this is a textnode, skip it
- continue;
- }
-
- tr = doc.createElement('tr');
- e = node.childNodes[i].getElementsByTagName('td');
-
- td = doc.createElement('td');
-
- var ref = e[0].childNodes[0];
-
- if(ref.nodeType != 1){
- td = doc.createElement('td');
- td.appendChild(e[0].firstChild);
- td.className = 'files';
- tr.appendChild(td);
- nbody.appendChild(tr);
- }
- else{
- var ref = e[0].childNodes[0].getAttribute('href');
- var aux = ""+e[0].firstChild.childNodes[0].nodeValue.replace(/\+/g,' ')+" ";
- td.innerHTML = decodeURIComponent(aux);
- td.className = 'files';
- tr.appendChild(td);
- nbody.appendChild(tr);
- }
- }
- tbody.parentNode.replaceChild(nbody,tbody);
-
-}
-
-
function DataConnection() {};
DataConnection.prototype = {
@@ -228,14 +152,10 @@
autoConnect: null,
httpSendCmd: function(url) {
-
// if (!this.connection) {
- //alert('httpSendCmd');
- //alert(url);
this.busy = true;
this.connection = getHttpObject();
// }
-
this.connection.open('GET', url + '&mc=' + msgcount++, true);
var self = this;
this.connection.onreadystatechange = function() {
@@ -245,7 +165,6 @@
},
httpReceiver: function(obj) {
- // alert('httpReceiver');
if (obj.connection.readyState == 4) {
if (obj.connection.status == 200) {
obj.handler(obj.connection.responseText);
@@ -258,7 +177,6 @@
},
chatSendMsg: function(send_url) {
- //alert('chatSendMsg');
// if (inactivityTimeout) {
// clearTimeout(inactivityTimeout);
// alert("Clearing inactivityTimeout");
@@ -271,11 +189,9 @@
alert("chatSendMsg conflict! Maybe banned?");
}
var msgField = document.getElementById('chatMsg');
- //alert(msgField);
if (msgField.value == '') {
return;
}
- //alert(send_url);
msgField.disabled = true;
this.httpSendCmd(send_url + escape(msgField.value));
msgField.value = '#chat.sending_message#';
@@ -295,10 +211,6 @@
}
function registerDataConnection(handler,url,autoConnect) {
-// alert('registerDataConnection');
- //alert(handler);
- //alert(url);
- //alert(autoConnect);
// var ds = new DataConnection(handler,url,autoConnect);
var ds = new DataConnection();
ds.handler = handler;
@@ -310,9 +222,7 @@
}
function updateDataConnections() {
- //alert('updateDataConnections');
for (var ds in dataConnections) {
- //alert(ds);
if (dataConnections[ds].autoConnect) {
// alert("updating " + dataConnections[ds].url);
dataConnections[ds].updateBackground();
@@ -329,15 +239,11 @@
}
function startProc() {
- // alert('startProc');
document.getElementById('chatMsg').focus();
var messagesDiv = frames['ichat'].document.getElementById('messages');
- // alert(frames['ichat'].document.getElementById('messages'));
- // alert('startProc2');
if (messagesDiv) {
frames['ichat'].window.scrollTo(0,messagesDiv.offsetHeight);
}
- // alert('startProc3');
}
window.onload = startProc;
Index: openacs-4/packages/chat/www/ajax/chat.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/ajax/Attic/chat.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat/www/ajax/chat.tcl 7 Jun 2007 09:14:25 -0000 1.3
+++ openacs-4/packages/chat/www/ajax/chat.tcl 19 Nov 2007 01:14:17 -0000 1.4
@@ -1,49 +1,16 @@
ad_page_contract {
a tiny chat client
- @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) and Pablo Mu�oz (pablomp@tid.es)
-
+ @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at)
+ @creation-date Jan 31, 2006
+ @cvs-id $Id$
} -query {
- m
+ m
id
s
- {msg:optional,allhtml ""}
+ {msg:optional,allhtml ""}
}
-set room [::chat::Chat create new -volatile -chat_id $id]
-set active_users [$room nr_active_users]
-set user_id [ad_conn user_id]
-
-
-
-
-db_1row room_info {
- select maximal_participants as maximal
- from chat_rooms as cp
- where cp.room_id = :id
-}
-if { $active_users >= $maximal} {
- #If the user is active and the room is full
- db_1row room_info {
- select count(chat_room_user_id.user_id) as count
- from chat_room_user_id
- where chat_room_user_id.user_id = :user_id
- and chat_room_user_id.room_id = :id
- }
- if { $count == 0 } {
- if { [permission::permission_p -party_id $user_id -object_id [dotlrn::get_package_id] -privilege admin] } {
-
- } else {
- #blanco
-
- ns_return 200 text/html "\
- [_ chat.You_dont_have_permission_room]
\
- "
- ad_script_abort
- }
- }
-}
-
set ban_p [permission::permission_p -object_id $id -privilege "chat_ban"]
if {$ban_p} {
ns_return 200 text/html "\
@@ -52,58 +19,9 @@
ad_script_abort
}
-db_1row date {
- select r.end_date as date, pretty_name as name
- from chat_rooms as r
- where r.room_id = :id
- }
-if { [clock format [clock seconds] -format "%Y/%m%d"] > $date } {
- db_0or1row update_closed {
- update chat_rooms SET open = 'false'
- WHERE room_id = :id;
- select 1;
- }
- ns_return 200 text/html "\
- [_ chat.closed_room]
\
- "
- ad_script_abort
-}
-set user_id [ad_conn user_id]
-db_1row room_info {
- select distinct count(cp.user_id1) as count1
- from chat_private_room_users as cp
- where cp.room_id = :id
- and cp.user_id1 = :user_id
-}
-
-db_1row room_info {
- select distinct count(cp.user_id1) as count2
- from chat_private_room_users as cp
- where cp.room_id = :id
- and cp.user_id2 = :user_id
-}
-db_1row room_info {
- select cr.private as private
- from chat_rooms as cr
- where cr.room_id = :id
-}
-if { $count1 == 0 && $count2 == 0 } {
- if { $private eq "t" } {
- ns_return 200 text/html "\
- [_ chat.You_dont_have_permission_room]
\
- "
- ad_script_abort
- }
-
-}
-
-
set message_output ""
set user_output "-"
-set files_output "-"
-
-#crea el objeto de tipo xotcl
::chat::Chat c1 -volatile -chat_id $id -session_id $s
switch -- $m {
@@ -125,26 +43,13 @@
set message_output [c1 $m]
}
get_updates {
-
- set message_output [c1 get_new]
-
+ set message_output [c1 get_new]
set user_output [c1 get_users]
-
- set files_output [c1 get_files]
-
-
}
get_users {
-
c1 encoder noencode
set user_output [c1 get_users]
-
}
- get_files {
-
- c1 encoder noencode
- set files_output [c1 get_files]
- }
default {ns_log error "--c unknown method $m called."}
}
@@ -159,25 +64,17 @@
#users { width: 100%; font-size: 12px; color: #666666; font-family: Trebuchet MS, Lucida Grande, Lucida Sans Unicode, Arial, sans-serif; }
#users .user {text-align: left; vertical-align: top; font-weight:bold; }
#users .timestamp {text-align: right; vertical-align: top; }
-#files { width: 100%; font-size: 12px; color: #666666; font-family: Trebuchet MS, Lucida Grande, Lucida Sans Unicode, Arial, sans-serif; }
-#files .file {text-align: left; vertical-align: top; font-weight:bold; }
-"
+"
if { $message_output ne "" } {
append output "$message_output
\n"
}
if { $user_output ne "-" } {
-
append output "\n"
}
-if { $files_output ne "-" } {
-
- append output "\n"
-}
-
append output "
"
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax/files.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax/users.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/rss/index.vuh'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/rss/rss.tcl'.
Fisheye: No comparison available. Pass `N' to diff?