Index: openacs-4/packages/chat/chat.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/chat.info,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/chat/chat.info 15 May 2007 20:14:23 -0000 1.9
+++ openacs-4/packages/chat/chat.info 7 Jun 2007 09:14:24 -0000 1.10
@@ -12,15 +12,16 @@
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/lib/current-messages.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/current-messages.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/chat/lib/current-messages.tcl 24 Jun 2006 14:23:41 -0000 1.2
+++ openacs-4/packages/chat/lib/current-messages.tcl 7 Jun 2007 09:14:24 -0000 1.3
@@ -7,7 +7,25 @@
}
db_multirow -extend { person_name } messages select_msg_itens $sql {
- if { [catch { set person_name [chat_user_name $creation_user] }] } {
- set person_name "Unknown"
+ 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
+ }
+ 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.2 -r1.3
--- openacs-4/packages/chat/lib/transcript-view.tcl 24 Jun 2006 14:23:41 -0000 1.2
+++ openacs-4/packages/chat/lib/transcript-view.tcl 7 Jun 2007 09:14:24 -0000 1.3
@@ -8,4 +8,21 @@
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.4 -r1.5
--- openacs-4/packages/chat/sql/postgresql/chat-create.sql 26 Oct 2006 11:11:19 -0000 1.4
+++ openacs-4/packages/chat/sql/postgresql/chat-create.sql 7 Jun 2007 09:14:24 -0000 1.5
@@ -1,9 +1,7 @@
--
-- packages/chat/sql/chat-create.sql
--
--- @author ddao@arsdigita.com
--- @creation-date November 09, 2000
--- @cvs-id $Id$
+-- @author ddao@arsdigita.com and Pablo Mu�oz(pablomp@tid.es)
--
@@ -86,6 +84,8 @@
);
+
+
attr_id := acs_attribute__create_attribute (
''chat_room'', -- object_type
''pretty_name'', -- attribute_name
@@ -180,37 +180,6 @@
SELECT inline_0();
DROP function inline_0();
----------------------------------------------
-
-CREATE TABLE "public"."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,
- 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 "public"."users"("user_id")
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
- NOT DEFERRABLE,
- CONSTRAINT "chat_rooms_room_id_fk" FOREIGN KEY ("room_id")
- REFERENCES "public"."acs_objects"("object_id")
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
- NOT DEFERRABLE
-) WITH OIDS;
-
-
---------------------------------------
-- create chat transcript object type
@@ -296,84 +265,251 @@
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
- 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_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_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_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 "public"."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,
- CONSTRAINT "chat_registered_users_pkey" PRIMARY KEY("registered_id"),
- CONSTRAINT "chat_registered_users_fk" FOREIGN KEY ("room_id")
- REFERENCES "public"."chat_rooms"("room_id")
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
+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 "public"."users"("user_id")
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
+ 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 "public"."acs_objects"("object_id")
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
+ 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 "public"."chat_room__new" (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, integer, integer, varchar, varchar) RETURNS integer AS'
+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;
+
+
+---------------------------------
+
+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, integer, integer, varchar, varchar, varchar, varchar) RETURNS integer AS'
/* Nuevo cuerpo de Function */
declare
p_pretty_name alias for $1;
@@ -392,6 +528,8 @@
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;
@@ -402,21 +540,21 @@
if exists (select dot.pretty_name from dotlrn_communities_all as dot where dot.community_id = p_comm_id) then
select into v_comm_name dot.pretty_name from dotlrn_communities_all as dot where dot.community_id = p_comm_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)
+ (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);
+ (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);
else
insert into chat_rooms
- (room_id, pretty_name, description, moderated_p, active_p, archive_p, maximal_participants, end_date, creator, context_id,comm_name)
+ (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,''Dotlrn'');
+ (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,''Dotlrn'',''true'', ''false'',''false'',p_frequency1);
end if;
insert into chat_registered_users
- (alias, room_id, user_id, RSS_service, mail_service, registered_id)
+ (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_alias, v_room_id, p_creation_user, p_Rss_service, p_Mail_service, v_registered_id, p_frequency2);
return v_room_id;
@@ -425,29 +563,9 @@
-
-
----------------------------------
-
-create 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';
-
-
-
-
-------------------------------
-
-
-create function chat_room__message_count (integer)
-returns integer as '
+CREATE OR REPLACE FUNCTION chat_room__message_count (integer) RETURNS integer AS'
declare
p_room_id alias for $1;
v_count integer;
@@ -457,55 +575,68 @@
where room_id = p_room_id;
return v_count;
-end;' language 'plpgsql';
+end;
+'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
---------------------------------
-
-
-create function chat_room__delete_all_msgs (integer)
-returns integer as '
+CREATE OR REPLACE 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';
+end;
+'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
---------------------------------
-
-create function chat_room__del (integer)
-returns integer as '
+CREATE OR REPLACE 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;
- -- First erase all the messages relate to this chat room.
+ -- Erase all the messages relate to this chat room.
delete from chat_msgs where room_id = p_room_id;
-
- -- Secondly erase all the registered users relate to this chat room.
- delete from chat_registered_users 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';
+end;
+'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-
---------------------------------
-CREATE OR REPLACE FUNCTION "public"."chat_room__delete_registered_users" (integer, integer) RETURNS integer AS'
+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;
@@ -520,7 +651,7 @@
---------------------------------
-CREATE OR REPLACE FUNCTION "public"."chat_room_registered__user" (varchar, integer, integer, boolean, boolean, integer, varchar) RETURNS integer AS'
+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;
@@ -530,22 +661,22 @@
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)
+ (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_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 function chat_transcript__new (varchar, varchar, varchar, integer, integer, timestamptz, integer, varchar, varchar)
-returns integer as '
+CREATE OR REPLACE FUNCTION chat_transcript__new (varchar, varchar, varchar, integer, integer, timestamptz, integer, varchar, varchar) RETURNS integer AS'
declare
p_pretty_name alias for $1;
@@ -568,17 +699,19 @@
p_context_id
);
- 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);
+ 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());
return v_transcript_id;
-end;' language 'plpgsql';
+end;
+'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-----------------------------
-create function chat_transcript__del (integer)
-returns integer as '
+
+
+CREATE OR REPLACE FUNCTION chat_transcript__del (integer) RETURNS integer AS'
declare
p_transcript_id alias for $1;
begin
@@ -591,11 +724,13 @@
PERFORM acs_object__delete(p_transcript_id);
return 0;
-end;' language 'plpgsql';
-----------------------------
+end;
+'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-CREATE OR REPLACE FUNCTION "public"."chat_room__edit" (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, integer) RETURNS integer AS'
+----------------------------
+
+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 */
declare
p_pretty_name alias for $1;
@@ -611,24 +746,30 @@
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;
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
- where room_id = p_room_id;
+ archive_p = p_archive_p,
+ frequency1 = p_frequency1
+ where
+ room_id = p_room_id;
- update chat_registered_users set
- alias = p_alias,
+ update chat_registered_users
+ set alias = p_alias,
RSS_service = p_Rss_service,
- mail_service = p_Mail_service
- where room_id = p_room_id
- and user_id = p_user_id;
+ 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;
@@ -637,8 +778,7 @@
---------------------------
-create function chat_room__message_post (integer, varchar, integer, varchar)
-returns integer as '
+CREATE OR REPLACE FUNCTION chat_room__message_post (integer, varchar, integer, varchar) RETURNS integer AS'
declare
p_room_id alias for $1;
p_msg alias for $2;
@@ -682,13 +822,13 @@
return 0;
-end;' language 'plpgsql';
+end;
+'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
---------------------------
-create function chat_transcript__edit (integer, varchar, varchar, varchar )
-returns integer as '
+CREATE OR REPLACE FUNCTION chat_transcript__edit (integer, varchar, varchar, varchar) RETURNS integer AS'
declare
p_transcript_id alias for $1;
p_pretty_name alias for $2;
@@ -704,84 +844,387 @@
return 0;
-end;' language 'plpgsql';
+end;
+'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
+-----------------------------
+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, integer, 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_id 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 );
+ if exists (select dot.pretty_name from dotlrn_communities_all as dot where dot.community_id = p_comm_id) then
+ select into v_comm_name dot.pretty_name from dotlrn_communities_all as dot where dot.community_id = p_comm_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);
+ else
+ 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,''Dotlrn'',''true'', ''false'',p_private);
+ end if;
+ 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;
@@ -802,3 +1245,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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.2 -r1.3
--- openacs-4/packages/chat/sql/postgresql/chat-drop.sql 26 Oct 2006 11:11:19 -0000 1.2
+++ openacs-4/packages/chat/sql/postgresql/chat-drop.sql 7 Jun 2007 09:14:24 -0000 1.3
@@ -46,27 +46,59 @@
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);
+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__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 (integer, varchar, varchar, boolean, boolean, boolean);
+drop function chat_room__edit (varchar, varchar, varchar, varchar, integer, timestamp, boolean, boolean, boolean, boolean, boolean, integer, integer, varchar);
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 table chat_registered_users;
+
--
-- Drop all chat privileges
--
Index: openacs-4/packages/chat/tcl/chat-ajax-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/Attic/chat-ajax-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/tcl/chat-ajax-procs-postgresql.xql 7 Jun 2007 09:14:24 -0000 1.1
@@ -0,0 +1,14 @@
+
+
+
+ postgresql7.1
+
+
+
+ select file_storage__get_root_folder(:package_id);
+
+
+
+
+
+
\ No newline at end of file
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.4 -r1.5
--- openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 30 Oct 2006 14:42:09 -0000 1.4
+++ openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 7 Jun 2007 09:14:24 -0000 1.5
@@ -34,6 +34,9 @@
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] } {
@@ -42,53 +45,114 @@
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=
+ set send_url ${path}ajax/chat?m=add_msg&$context&msg=
+ #$send_file
- set users_url ${path}ajax/chat?m=get_users&$context
+ 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
+
+
return "\
+
- "
-
+ style='width:16%; border:1px solid black; margin-right:12px;' height='257'>
+
+
+
+
+
+"
}
- Chat instproc render2 {-chat_id } {
+ Chat instproc render2 {-chat_id} {
my orderby time
set result ""
set msg_true "f"
+
+
+
db_1row room_info {
select room.maximal_participants as maxp
from chat_rooms as room
where room.room_id = :chat_id
- }
-
+ }
+
+
foreach child [my children] {
- set msg [$child msg]
+
+ set msg [$child msg]
set msg_all ""
for {set i 0} {$i < [llength $msg]} {incr i 1} {
set word [lindex $msg $i]
- for {set j 0} {$j < [llength $word]} {incr j 1} {
+ set j 0
if { [string range $word $j $j] eq "h" } {
set aux [expr $j+1]
if { [string range $word $aux [expr $aux+5] ] eq "ttp://" } {
@@ -108,25 +172,31 @@
}
}
}
- }
+
}
set user_id [$child user_id]
- set color [$child color]
+ set color [$child color]
+ set timelong [clock format [$child time]]
+ set timeshort [clock format [$child time] -format {[%H:%M:%S]}]
+ set timeshort2 [clock format [$child time] -format {[%D]}]
+
- set timelong [clock format [$child time]]
- set timeshort [clock format [$child time] -format {[%H:%M:%S]}]
+
+
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 } {
+ set timeshort [clock format [$child time] -format {[%H:%M:%S]}]
db_1row room_info {
select alias as alias
from chat_registered_users
@@ -166,16 +236,17 @@
}
append result "
\n"
- } else {
-
+ } else {
append result "$timeshort" \
"$userlink:" \
"[my encode $msg]
\n"
}
}
- if {$info eq 0} {
+ if {$info eq 0} {
+ set timeshort [clock format [$child time] -format {[%H:%M:%S]}]
+
set userlink [my user_link -user_id $user_id -color $color]
if {$msg_true eq "t"} {
@@ -216,9 +287,106 @@
}
}
}
+
+ #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
}
-}
\ No newline at end of file
+}
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.2 -r1.3
--- openacs-4/packages/chat/tcl/chat-init.tcl 24 Jun 2006 14:23:41 -0000 1.2
+++ openacs-4/packages/chat/tcl/chat-init.tcl 7 Jun 2007 09:14:24 -0000 1.3
@@ -10,6 +10,5 @@
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 0 5] chat_flush_rooms
-
+
+ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 18 05] chat_flush_rooms
Index: openacs-4/packages/chat/tcl/chat-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/Attic/chat-install-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/tcl/chat-install-procs.tcl 7 Jun 2007 09:14:24 -0000 1.1
@@ -0,0 +1,18 @@
+ad_library {
+
+ Sets up WebDAV support service contracts
+
+ @author Pablo Mu�oz (pablomp@tid.es)
+ @creation-date 2007-01-08
+
+}
+
+
+namespace eval chat::install {}
+
+ad_proc -private chat::install::package_install {} {
+} {
+ db_transaction {
+ chat::rss::create_rss_gen_subscr_impl
+ }
+}
\ No newline at end of file
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.3 -r1.4
--- openacs-4/packages/chat/tcl/chat-procs-postgresql.xql 26 Oct 2006 11:11:20 -0000 1.3
+++ openacs-4/packages/chat/tcl/chat-procs-postgresql.xql 7 Jun 2007 09:14:24 -0000 1.4
@@ -16,16 +16,152 @@
boolean :active_p,
boolean :archive_p,
integer :context_id,
+ integer :comm_id,
+ integer :creation_user,
+ varchar :creation_ip,
+ varchar 'chat_room',
+ varchar :frequency1,
+ varchar :frequency2
+ )
+
+
+
+
+
+ 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,
integer :comm_id,
integer :creation_user,
varchar :creation_ip,
- varchar 'chat_room'
+ 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).
@@ -119,7 +255,7 @@
- begin
+ begin
perform chat_room__edit (
:pretty_name,
:alias,
@@ -131,16 +267,33 @@
:Mail_service,
:moderated_p,
:active_p,
- :archive_p,
- :user_id,
- :room_id
+ :archive_p,
+ :user_id,
+ :room_id,
+ :frequency1,
+ :frequency_mail
);
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);
@@ -229,6 +382,17 @@
+
+
+
+ select chat_room__store_transcripts_keywords (
+ :word,
+ :transcript_id
+ )
+
+
+
+
select chat_room_registered__user (
@@ -238,12 +402,144 @@
boolean :RSS_service,
boolean :mail_service,
integer :context_id,
- varchar :creation_ip
+ 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.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/Attic/chat-procs.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/chat/tcl/chat-procs.xql 24 Jun 2006 14:23:41 -0000 1.2
+++ openacs-4/packages/chat/tcl/chat-procs.xql 7 Jun 2007 09:14:24 -0000 1.3
@@ -17,12 +17,14 @@
where transcript_id = :transcript_id
+
+
select room_id
from chat_rooms
- where archive_p = 't' and auto_flush_p = 't'
+ where archive_p = 't'
@@ -31,10 +33,41 @@
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/tcl/chatb.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/Attic/chatb.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/tcl/flecha01atras.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/Attic/flecha01atras.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/tcl/resources/chatb.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/resources/Attic/chatb.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/tcl/resources/chatpicture.jpg
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/resources/Attic/chatpicture.jpg,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/tcl/resources/flecha01atras.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/resources/Attic/flecha01atras.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/tcl/resources/icono_chat.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/resources/Attic/icono_chat.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/tcl/resources/icono_chat2.jpg
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/resources/Attic/icono_chat2.jpg,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/tcl/resources/xml.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/resources/Attic/xml.gif,v
diff -u
Binary files differ
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.2 -r1.3
--- openacs-4/packages/chat/www/ajax-chat-script.adp 24 Jun 2006 14:23:41 -0000 1.2
+++ openacs-4/packages/chat/www/ajax-chat-script.adp 7 Jun 2007 09:14:25 -0000 1.3
@@ -4,9 +4,10 @@
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.3 -r1.4
--- openacs-4/packages/chat/www/ajax-chat-script.tcl 26 Oct 2006 11:11:20 -0000 1.3
+++ openacs-4/packages/chat/www/ajax-chat-script.tcl 7 Jun 2007 09:14:25 -0000 1.4
@@ -5,7 +5,7 @@
@creation-date Jan 31, 2006
@cvs-id $Id$
} -query {
- msg:optional
+ msg:optional
}
set chat_frame [ ::chat::Chat login -chat_id $room_id]
Index: openacs-4/packages/chat/www/chat-transcript-search-2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/chat-transcript-search-2.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/chat-transcript-search-2.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,5 @@
+
+#chat.Transcripts#
+#chat.Transcripts_found# "@room_name;noquote@"
+
+
\ No newline at end of file
Index: openacs-4/packages/chat/www/chat-transcript-search-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/chat-transcript-search-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/chat-transcript-search-2.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,137 @@
+ad_page_contract {
+ Display a form to create a new room.
+
+ @author Pablo Mu�oz (pablomp@tid.es)
+} {
+ room_id
+ pretty_name
+ date2
+ partitipants
+ key_words
+ sent_files
+ sent_files_title
+}
+set transcript_delete_p [permission::permission_p -object_id $room_id -privilege chat_transcript_delete]
+set transcript_view_p [permission::permission_p -object_id $room_id -privilege chat_transcript_view]
+
+set query ""
+set query1 ""
+set query2 ""
+set query3 ""
+set query4 ""
+set query5 ""
+set query6 ""
+
+db_1row room_info {
+ select cr.pretty_name as room_name
+ from chat_rooms cr
+ where cr.room_id = :room_id
+}
+
+#append query "select distinct ct.transcript_id, ct.pretty_name, ao.creation_date,cr.room_id
+# from chat_transcripts ct, chat_partitipants_transcript ptr,acs_objects ao, chat_rss crss, chat_room_transcript_keywords as tk, chat_rooms_files_sent fs,chat_file_transcript ftr, chat_rooms cr where"
+
+append query "select distinct ct.transcript_id, ct.pretty_name, ao.creation_date,cr.room_id
+ from chat_transcripts ct,acs_objects ao, chat_rooms cr "
+
+
+if { !($partitipants eq "") } {
+ append query ",chat_partitipants_transcript ptr"
+}
+if { !($sent_files_title eq "") } {
+ append query ",chat_rooms_files_sent fs"
+}
+if { !($sent_files eq "") } {
+ if { $sent_files_title eq "" } {
+ append query ",chat_rooms_files_sent fs"
+ }
+}
+if { !($key_words eq "") } {
+ append query ",chat_room_transcript_keywords tk"
+}
+
+
+if { !($pretty_name eq "") } {
+ set query1 " where ct.pretty_name = :pretty_name"
+
+}
+if {!($date2 eq "") } {
+ if { !($pretty_name eq "") } {
+ set query2 " and ct.date = :date2 "
+
+ } else {
+ set query2 " where ct.date = :date2 "
+
+ }
+}
+if { !($partitipants eq "") } {
+ if { !($pretty_name eq "") || !($date2 eq "")} {
+ set query3 " and ptr.partitipant = :partitipants and ptr.transcript_id = ct.transcript_id "
+
+ } else {
+ set query3 " where ptr.partitipant = :partitipants and ptr.transcript_id = ct.transcript_id "
+
+ }
+}
+if { !($sent_files_title eq "") } {
+ if { !($pretty_name eq "") || !($date2 eq "") || !($partitipants eq "") } {
+ set query4 " and fs.title = :sent_files_title and fs.send_file_id = ftr.file_id and ftr.transcript_id = ct.transcript_id"
+
+ } else {
+ set query4 " where fs.title = :sent_files_title and fs.send_file_id = ftr.file_id and ftr.transcript_id = ct.transcript_id "
+
+ }
+}
+if { !($sent_files eq "") } {
+ if { !($pretty_name eq "") || !($date2 eq "") || !($partitipants eq "") || !($sent_files_title eq "") } {
+ set query5 " and fs.file = :sent_files and fs.send_file_id = ftr.file_id and ftr.transcript_id = ct.transcript_id"
+
+ } else {
+ set query5 " where fs.file = :sent_files and fs.send_file_id = ftr.file_id and ftr.transcript_id = ct.transcript_id "
+
+ }
+}
+if { !($key_words eq "") } {
+ if { !($pretty_name eq "") || !($date2 eq "") || !($partitipants eq "") || !($sent_files_title eq "") || !($sent_files eq "") } {
+ set query6 " and tk.keyword = :key_words and tk.transcript_id = ct.transcript_id"
+
+ } else {
+ set query6 " where tk.keyword = :key_words and tk.transcript_id = ct.transcript_id "
+
+ }
+}
+set creation_date ""
+set query7 " and ct.transcript_id = ao.object_id
+ and ct.room_id = :room_id and cr.room_id = ct.room_id
+ order by ao.creation_date desc"
+set queryT [concat $query $query1 $query2 $query3 $query4 $query5 $query6 $query7]
+
+#$queryT
+db_multirow -extend { creation_date_pretty } chat_transcripts *SQL* $queryT {
+ set creation_date_pretty [lc_time_fmt $creation_date "%q %X"]
+
+}
+
+list::create \
+ -name "chat_transcripts" \
+ -multirow "chat_transcripts" \
+ -elements {
+ pretty_name {
+ label "#chat.Name#"
+ link_url_eval {chat-transcript?room_id=$room_id&transcript_id=$transcript_id}
+ }
+ creation_date_pretty {
+ label "#chat.creation_date#"
+ }
+ actions {
+ label "#chat.actions#"
+ html { align "center" }
+ display_template {
+
+
+
+
+
+ }
+ }
+ }
\ No newline at end of file
Index: openacs-4/packages/chat/www/chat-transcript-search-2.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/chat-transcript-search-2.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/chat-transcript-search-2.xql 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,18 @@
+
+
+
+
+
+ select ct.transcript_id, ct.pretty_name, ao.creation_date,crss.room_name,cr.room_id as room_id
+ from chat_transcripts ct, acs_objects ao, chat_rss crss,chat_rooms cr
+ where crss.transcription_name = :pretty_name
+ or crss.transcription_date = :date2 or crss.partitipants = :partitipants or crss.file_name = :sent_files
+ or crss.file_name=:sent_files or crss.keywords = :key_words
+ and ct.transcript_id = ao.object_id
+ and ct.pretty_name = crss.transcription_name
+ and cr.pretty_name = crss.room_name
+ order by ao.creation_date desc
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/chat/www/chat-transcript-search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/chat-transcript-search.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/chat-transcript-search.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,77 @@
+ad_page_contract {
+ Display a form to create a new room.
+
+ @author Pablo Mu�oz (pablomp@tid.es)
+} {
+ room_id:integer,notnull
+}
+
+ad_require_permission [ad_conn package_id] chat_room_create
+
+
+set title "[_ chat.search_transcription]"
+set action "transcript-search-2"
+set pretty_name ""
+set description ""
+set key_words ""
+set date ""
+set partitipants ""
+set reg_users ""
+set sent_files ""
+set submit_label "[_ chat.search_transcription]"
+
+
+
+ad_form -name "transcript-search" -edit_buttons [list [list [_ chat.search_transcription] next]] -has_edit 1 -form {
+ {room_id:key}
+ {pretty_name:text(text),optional
+ {label "#chat.name_rss2#" }
+ }
+ {date:date(date),optional
+ {label "#chat.date_rss2#" }
+ }
+ {partitipants:text,optional
+ {label "#chat.partitipants2#" }
+ {html {rows 3 cols 25}}
+ }
+ {key_words:text,optional
+ {label "#chat.keyword#" }
+ {html {rows 3 cols 25}}
+ }
+ {sent_files:text,optional
+ {label "#chat.files_sent2#" }
+ {html {rows 3 cols 25}}
+ }
+ {sent_files_title:text,optional
+ {label "#chat.files_sent4#" }
+ {html {rows 3 cols 25}}
+ }
+} -edit_request {
+
+} -edit_data {
+
+} -after_submit {
+
+
+ set date2 [lrange $date 0 2]
+ ad_returnredirect "chat-transcript-search-2?room_id=$room_id&pretty_name=$pretty_name&date2=$date2&partitipants=$partitipants&key_words=$key_words&sent_files=$sent_files&sent_files_title=$sent_files_title"
+ ad_script_abort
+}
+
+ad_return_template "transcript-search"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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.2 -r1.3
--- openacs-4/packages/chat/www/chat-transcripts.adp 24 Jun 2006 14:23:41 -0000 1.2
+++ openacs-4/packages/chat/www/chat-transcripts.adp 7 Jun 2007 09:14:25 -0000 1.3
@@ -1,9 +1,9 @@
#chat.Transcripts#
-#chat.transcripts_of_room# "@room_name;noquote@"
+#chat.transcript_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.8 -r1.9
--- openacs-4/packages/chat/www/chat.tcl 26 Oct 2006 11:11:20 -0000 1.8
+++ openacs-4/packages/chat/www/chat.tcl 7 Jun 2007 09:14:25 -0000 1.9
@@ -3,7 +3,7 @@
Decide which template to use HTML or AJAX.
- @author David Dao (ddao@arsdigita.com)
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
@creation-date November 22, 2000
@cvs-id $Id$
} {
@@ -45,9 +45,17 @@
}
if { ($read_p == "0" && $write_p == "0") || ($ban_p == "1") } {
- #Display unauthorize privilege page.
- ad_returnredirect unauthorized
- ad_script_abort
+ 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
+ }
}
# Get chat screen name.
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.2 -r1.3
--- openacs-4/packages/chat/www/index-postgresql.xql 24 Jun 2006 14:23:42 -0000 1.2
+++ openacs-4/packages/chat/www/index-postgresql.xql 7 Jun 2007 09:14:25 -0000 1.3
@@ -11,6 +11,9 @@
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)
@@ -24,5 +27,28 @@
+
+
+ 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,dotlrn_communities_all as dot
+ 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.7 -r1.8
--- openacs-4/packages/chat/www/index.adp 6 Dec 2006 12:33:57 -0000 1.7
+++ openacs-4/packages/chat/www/index.adp 7 Jun 2007 09:14:25 -0000 1.8
@@ -17,9 +17,14 @@
#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.5 -r1.6
--- openacs-4/packages/chat/www/index.tcl 15 May 2007 20:14:23 -0000 1.5
+++ openacs-4/packages/chat/www/index.tcl 7 Jun 2007 09:14:25 -0000 1.6
@@ -20,21 +20,92 @@
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-new "#chat.Create_a_new_room#"
}
+lappend actions "#chat.Search_a_room#" room-search?package_id=[ad_conn package_id] "#chat.Search_a_room#"
-db_multirow -extend { active_users last_activity } rooms rooms_list {} {
+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 {} {
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" \
@@ -43,35 +114,78 @@
-actions $actions \
-row_pretty_plural [_ chat.rooms] \
-elements {
- active {
- label "#chat.Active#"
+ open {
+ label "#chat-portlet.open_room#"
html { align "center" }
display_template {
-
+
+
-
+
-
+
}
+ }
+ private {
+ label "#chat-portlet.private_room#"
+ html { align "center" }
+ display_template {
+
+
+
+
+
+
+
+
+
+
+
+ }
}
pretty_name {
label "#chat.Room_name#"
- html { width 400px }
+ html { align "center" }
display_template {
- @rooms.pretty_name@ \[#chat.HTML_chat#\]
+ @rooms.pretty_name@
@rooms.pretty_name@
- @rooms.description@
+ @rooms.description@
}
}
+ community {
+ label "#chat-portlet.community_class#"
+ html { align "center"}
+ display_template {
+
+ @rooms.community@
+
+ }
+ }
+ rss {
+ label "#chat-portlet.rss#"
+ html { align "center" }
+ display_template {
+
+
+
+
#rss-support.Syndication_Feed#
+
+ #chat-portlet.no_rss#
+
+
+ #chat-portlet.no_rss#
+
+ }
+ }
active_users {
label "#chat.active_users#"
html { style "text-align:center;" }
@@ -83,12 +197,133 @@
actions {
label "#chat.actions#"
display_template {
- #chat.Transcripts#
-
- #chat.room_admin#
+
+
+ #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-portlet.open_room#"
+ html { align "center" }
+ display_template {
+
+
+
+
+
+
+
+
+
+
}
+ }
+ private {
+ label "#chat-portlet.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-portlet.community_class#"
+ html { align "center"}
+ display_template {
+
+ @rooms2.community@
+
+ }
+ }
+ rss {
+ label "#chat-portlet.rss#"
+ html { align "center" }
+ display_template {
+
+
+
+
#rss-support.Syndication_Feed#
+
+ #chat-portlet.no_rss#
+
+
+ #chat-portlet.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/logoff.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/logoff.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/logoff.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,20 @@
+
+
+Log off
+
+
+Are you sure you want to log off?
+
+
Index: openacs-4/packages/chat/www/logoff.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/logoff.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/logoff.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,8 @@
+ad_page_contract {
+ Log on chat room.
+ @author Pablo Mu�oz (pablomp@tid.es)
+ @creation-date September 19, 2006
+} {
+ action
+ room_id
+}
\ No newline at end of file
Index: openacs-4/packages/chat/www/logoff2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/logoff2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/logoff2.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,11 @@
+ad_page_contract {
+ Log on chat room.
+ @author Pablo Mu�oz (pablomp@tid.es)
+ @creation-date September 19, 2006
+} {
+ room_id
+ action
+}
+set user_id [ad_conn user_id]
+set delete [chat_room_delete_registered_users $room_id $user_id]
+ad_returnredirect $action
\ No newline at end of file
Index: openacs-4/packages/chat/www/logon.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/logon.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/logon.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,9 @@
+
+
+Log on
+
+
Index: openacs-4/packages/chat/www/logon.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/logon.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/logon.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,67 @@
+ad_page_contract {
+ Log on chat room.
+ @author Pablo Mu�oz (pablomp@tid.es)
+ @creation-date September 19, 2006
+} {
+ room_id
+}
+
+set Rss_service ""
+set Mail_service ""
+set alias ""
+
+
+ad_form -name "logon" -edit_buttons [list [list [_ chat.enter_room] next]] -has_edit 1 -form {
+ {room_id:key}
+ {alias:text(text)
+ {label "Alias" }
+ }
+ {Rss_service:boolean(radio)
+ {label "Rss_service" }
+ {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
+ {value "f"}
+ }
+ {frequency1:boolean(select),optional
+ {label "Frequency Rss" }
+ {options {{"daily"} {"monthly" } {"weekly" }}}
+ }
+ {Mail_service:boolean(radio)
+ {label "Mail_service" }
+ {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
+ {value "f"}
+ }
+ {frequency2:boolean(select),optional
+ {label "Frequency Mail" }
+ {options {{"daily"} {"monthly" } {"weekly" }}}
+ }
+} -new_data {
+
+
+} -edit_request {
+} -after_submit {
+ set context_id [ad_conn package_id]
+ set creation_ip [ad_conn peeraddr]
+ set user_id [ad_conn user_id]
+ db_1row room_info {
+ select count(1) as info
+ from chat_registered_users
+ where room_id = :room_id
+ and user_id = :user_id
+ }
+ if { $info == 0 } {
+ if {[catch {set user [chat_registered_user -RSS_service $Rss_service \
+ -mail_service $Mail_service \
+ -context_id $context_id \
+ -creation_ip $creation_ip \
+ $room_id $alias $user_id]} errmsg]} {
+ ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg"
+ break
+ }
+ } else {
+
+ }
+ ad_returnredirect "room?room_id=$room_id"
+ ad_script_abort
+}
+ad_return_template "logon"
+
\ No newline at end of file
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.5 -r1.6
--- openacs-4/packages/chat/www/message-delete-2.tcl 8 Aug 2006 21:26:19 -0000 1.5
+++ openacs-4/packages/chat/www/message-delete-2.tcl 7 Jun 2007 09:14:25 -0000 1.6
@@ -2,14 +2,29 @@
ad_page_contract {
Delete messages in the room.
- @author David Dao (ddao@arsdigita.com)
- @creation-date January 18, 2001
- @cvs-id $Id$
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
+
} {
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"
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.3 -r1.4
--- openacs-4/packages/chat/www/message-delete.tcl 14 Mar 2006 12:16:09 -0000 1.3
+++ openacs-4/packages/chat/www/message-delete.tcl 7 Jun 2007 09:14:25 -0000 1.4
@@ -2,9 +2,8 @@
ad_page_contract {
Display delete message confirmation.
- @author David Dao (ddao@arsdigita.com)
- @creation-date January 18, 2001
- @cvs-id $Id$
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz (pablomp@tid.es)
+
} {
room_id:notnull,integer
} -properties {
@@ -14,7 +13,23 @@
context_bar:onevalue
}
-ad_require_permission $room_id chat_room_delete
+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
+}
set context_bar [list [list "room?room_id=$room_id" "[_ chat.Room_Information]"] "[_ chat.Delete_messages]"]
Index: openacs-4/packages/chat/www/options.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/options.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/chat/www/options.adp 26 Oct 2006 13:03:59 -0000 1.1
+++ openacs-4/packages/chat/www/options.adp 7 Jun 2007 09:14:25 -0000 1.2
@@ -1,9 +1,50 @@
-
-Options
+#chat.room_options#
-
\ No newline at end of file
+
+
+
+#chat.room_options#
+
+
+
+
+ #chat.alias# |
+ @alias@ |
+
+
+ #chat.rss_service# |
+ @rss_service@ |
+
+
+ #chat.mail_service# |
+ @mail_service@ |
+
+
+
+
+#chat.edit_room_options#
+
+
+
+#chat.Transcripts#
+
+
+#chat.current_transcript#
+
+
+
+
Index: openacs-4/packages/chat/www/options.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/options.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/chat/www/options.tcl 26 Oct 2006 12:56:22 -0000 1.1
+++ openacs-4/packages/chat/www/options.tcl 7 Jun 2007 09:14:25 -0000 1.2
@@ -5,9 +5,11 @@
} {
action
room_id
+ {transcript_id:integer,optional 0}
}
set user_id [ad_conn user_id]
+
db_1row room_info {
select rm.room_id,
(select ru.alias
@@ -26,66 +28,8 @@
where rm.room_id = :room_id
}
-ad_form -name "options" -edit_buttons [list [list [_ chat.room_options] next]] -has_edit 1 -form {
- {room_id:key}
- {action:text(hidden)
- {value $action}}
- {alias:text(text)
- {label "Alias" }
- }
- {rss_service:boolean(radio)
- {label "Rss_service" }
- {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
- {value "f"}
- }
- {frequency1:boolean(select),optional
- {label "Frequency Rss" }
- {options {{"daily"} {"monthly" } {"weekly" }}}
- }
- {mail_service:boolean(radio)
- {label "Mail_service" }
- {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
- {value "f"}
- }
- {frequency2:boolean(select),optional
- {label "Frequency Mail" }
- {options {{"daily"} {"monthly" } {"weekly" }}}
- }
-} -after_submit {
- set context_id [ad_conn package_id]
- set creation_ip [ad_conn peeraddr]
- set user_id [ad_conn user_id]
- db_1row room_info {
- select count(1) as info
- from chat_registered_users
- where room_id = :room_id
- and user_id = :user_id
- }
- if { $info == 0 } {
- if {[catch {set user [chat_registered_user -RSS_service $rss_service \
- -mail_service $mail_service \
- -context_id $context_id \
- -creation_ip $creation_ip \
- $room_id $alias $user_id]} errmsg]} {
- ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg"
- break
- }
- } else {
-
- set del [chat_room_delete_registered_users $room_id $user_id]
- if {[catch {set user [chat_registered_user -RSS_service $rss_service \
- -mail_service $mail_service \
- -context_id $context_id \
- -creation_ip $creation_ip \
- $room_id $alias $user_id]} errmsg]} {
- ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg"
- break
- }
- }
- ad_returnredirect $action
- ad_script_abort
-} -new_data {
-} -edit_request {
-}
+
+
+
ad_return_template "options"
\ No newline at end of file
Index: openacs-4/packages/chat/www/options2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/options2.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/options2.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,9 @@
+
+
+Options
+
+
\ No newline at end of file
Index: openacs-4/packages/chat/www/options2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/options2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/options2.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,109 @@
+ad_page_contract {
+ Options chat room.
+ @author Pablo Mu�oz (pablomp@tid.es)
+ @creation-date October 10, 2006
+} {
+ action
+ room_id
+}
+set user_id [ad_conn user_id]
+
+db_1row room_info {
+ select rm.room_id,
+ (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
+ from chat_rooms rm
+ where rm.room_id = :room_id
+}
+set rss_active $rss_service
+
+ad_form -name "options" -edit_buttons [list [list [_ chat.change_room_options] next]] -has_edit 1 -form {
+ {room_id:key}
+ {action:text(hidden)
+ {value $action}}
+ {alias:text(text)
+ {label "#chat.alias#" }
+ {help_text "[_ chat.alias_in_this_room]"}
+ }
+ {rss_service:boolean(radio)
+ {label "#chat.rss_service#" }
+ {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
+ {help_text "[_ chat.rss_syndication]"}
+ }
+ {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} {"monthly" monthly} {"weekly" weekly}}}
+ {help_text "[_ chat.frequency_mail_description]"}
+ }
+} -after_submit {
+
+ set community_id [dotlrn_community::get_community_id]
+ set context_id [ad_conn package_id]
+ set creation_ip [ad_conn peeraddr]
+ set package_id [ad_conn package_id]
+ set user_id [ad_conn user_id]
+ db_1row room_info {
+ select count(1) as info
+ from chat_registered_users
+ where room_id = :room_id
+ and user_id = :user_id
+ }
+ if { $info == 0 } {
+ if {[catch {set user [chat_registered_user -RSS_service $rss_service \
+ -mail_service $mail_service \
+ -context_id $context_id \
+ -creation_ip $creation_ip \
+ -frequency_mail $frequency2 \
+ $room_id $alias $user_id]} errmsg]} {
+
+ ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg"
+ break
+ }
+ } else {
+
+ set del [chat_room_delete_registered_users $room_id $user_id]
+ if {[catch {set user [chat_registered_user -RSS_service $rss_service \
+ -mail_service $mail_service \
+ -context_id $context_id \
+ -creation_ip $creation_ip \
+ -frequency_mail $frequency2 \
+ $room_id $alias $user_id]} errmsg]} {
+
+ ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg"
+ break
+ }
+ }
+
+ if { $mail_service eq "t"} {
+ if { $frequency2 eq "dayly" } {
+ ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 00 29] chat_send_mails $room_id $community_id $user_id $package_id
+ }
+ if { $frequency2 eq "weekly" } {
+ ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 15 16] chat_send_mails $room_id $community_id $user_id $package_id
+ }
+ if { $frequency2 eq "monthly" } {
+ set week 1
+ ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 15 18] chat_send_mails_monthly $room_id $community_id $user_id $package_id $week
+ }
+ }
+
+ ad_returnredirect $action
+ ad_script_abort
+} -new_data {
+} -edit_request {
+}
\ No newline at end of file
Index: openacs-4/packages/chat/www/private-room.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/private-room.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/private-room.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+@room_id;noquote@
+
Index: openacs-4/packages/chat/www/private-room.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/private-room.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/private-room.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,123 @@
+ad_page_contract {
+ page to add a new file to the system
+
+ @author Pablo Mu�oz (pablomp@tid.es)
+ @creation-date 26 Feb 2007
+} {
+ room_id:integer,optional
+ user_id1:integer,optional
+ user_id2:integer,optional
+} -properties {
+ context_bar:onevalue
+ room_id:onevalue
+ title:onevalue
+ action:onevalue
+ submit_label:onevalue
+ pretty_name:onevalue
+ moderated_p:onevalue
+}
+
+#ad_require_permission [ad_conn package_id] chat_room_create
+
+set context_bar [list "[_ chat.Create_a_room]"]
+set title "[_ chat.Create_a_room]"
+set action "room-new-2"
+set submit_label "[_ chat.Create_room]"
+set pretty_name ""
+set description ""
+set archive_p "t"
+set active_p "t"
+set moderated_p "f"
+
+set maxP ""
+set minP ""
+set end_date ""
+set key_words ""
+set alias ""
+set Rss_service ""
+set frequency [list daily monthly weekly]
+
+#permission::require_permission -object_id [ad_conn package_id] -privilege chat_room_edit
+
+set user_id [ad_conn user_id]
+
+
+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.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,
+ rm.end_date as end_date,
+ (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
+ from chat_rooms rm
+ where rm.room_id = :room_id
+}
+
+if { $alias eq "" } {
+ db_1row room_info {
+ select du.first_names as alias
+ from dotlrn_users as du, users as u
+ where u.user_id = :user_id
+ and u.user_id = du.user_id
+
+ }
+}
+
+ set date [lrange $end_date 0 2]
+ set comm_id [dotlrn_community::get_community_id]
+ if { $comm_id eq "" } {
+ set comm_id 0
+ } else {
+ set comm_id [dotlrn_community::get_community_id]
+ }
+
+ append name $pretty_name "_private_"
+ set pretty_name ""
+ append pretty_name $name $alias
+ if {[catch {set room_id [chat_room_private_new \
+ -alias $alias \
+ -key_words "dsa" \
+ -maxP $max_p \
+ -end_date $date \
+ -Rss_service "true" \
+ -Mail_service "true" \
+ -moderated_p $moderated_p \
+ -active_p $active_p \
+ -archive_p $archive_p \
+ -auto_flush_p t \
+ -auto_transcript_p t \
+ -context_id [ad_conn package_id] \
+ -comm_id $comm_id \
+ -creation_user [ad_conn user_id] \
+ -creation_ip [ad_conn peeraddr] \
+ -private "true" \
+ $description $pretty_name]} errmsg]} {
+ ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg"
+ break
+ }
+ db_dml insert_users {insert into chat_private_room_users (room_id,user_id1,user_id2) values (:room_id,:user_id1,:user_id2);}
+ad_returnredirect "chat?room_id=$room_id&client=ajax"
+
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.3 -r1.4
--- openacs-4/packages/chat/www/room-delete-2.tcl 14 Mar 2006 12:16:09 -0000 1.3
+++ openacs-4/packages/chat/www/room-delete-2.tcl 7 Jun 2007 09:14:25 -0000 1.4
@@ -2,14 +2,30 @@
ad_page_contract {
Delete the chat room.
- @author David Dao (ddao@arsdigita.com)
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
@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.3 -r1.4
--- openacs-4/packages/chat/www/room-delete.tcl 14 Mar 2006 12:16:09 -0000 1.3
+++ openacs-4/packages/chat/www/room-delete.tcl 7 Jun 2007 09:14:25 -0000 1.4
@@ -2,9 +2,8 @@
ad_page_contract {
Display delete confirmation.
- @author David Dao (ddao@arsdigita.com)
- @creation-date November 15, 2000
- @cvs-id $Id$
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
+
} {
room_id:notnull,integer
} -properties {
@@ -13,8 +12,25 @@
context_bar:onevalue
}
-ad_require_permission $room_id chat_room_delete
+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
+}
+
set context_bar [list [list "room?room_id=$room_id" "[_ chat.Room_Information]"] "[_ chat.Delete_room]"]
set pretty_name [chat_room_name $room_id]
Index: openacs-4/packages/chat/www/room-edit-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-edit-2.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/chat/www/room-edit-2.tcl 26 Oct 2006 13:03:59 -0000 1.6
+++ openacs-4/packages/chat/www/room-edit-2.tcl 7 Jun 2007 09:14:25 -0000 1.7
@@ -13,12 +13,27 @@
{archive_p "f"}
{active_p "f"}
}
+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_edit
+}
-ns_log notice "receive: moderated_p:$moderated_p archive_p:$archive_p active_p:$active_p"
-
if {[catch {chat_room_edit $room_id $pretty_name $description $moderated_p $active_p $archive_p} errmsg]} {
ad_return_complaint 1 "[_ chat.Could_not_update_room]: $errmsg"
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.6 -r1.7
--- openacs-4/packages/chat/www/room-edit.tcl 26 Oct 2006 11:11:20 -0000 1.6
+++ openacs-4/packages/chat/www/room-edit.tcl 7 Jun 2007 09:14:25 -0000 1.7
@@ -2,14 +2,31 @@
ad_page_contract {
Display a form to edit room information.
- @author Peter Alberer (peter@alberer.com)
- @creation-date March 26, 2006
+ @author Peter Alberer (peter@alberer.com) and Pablo Mu�oz(pablomp@tid.es)
} {
room_id:integer,optional
}
-permission::require_permission -object_id [ad_conn package_id] -privilege chat_room_edit
+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 [ad_conn package_id] -privilege chat_room_edit
+}
+
if { ![info exists room_id] } {
set title "[_ chat.Create_a_new_room]"
} else {
@@ -20,92 +37,103 @@
db_1row room_info {
- select rm.room_id,
- rm.pretty_name as pretty_name,
- 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,
- rm.end_date as end_date,
- (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 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}
{pretty_name:text(text)
{label "#chat.Room_name#" }
+ {title "Name of the room"}
}
{alias:text(text)
- {label "Alias" }
- {help_text "Alias in this room"}
+ {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 "Key words" }
+ {label "#chat.keywords#" }
{html {rows 3 cols 25}}
- {help_text "Main words of the room, in order to describe it"}
-
+ {help_text "[_ chat.main_words]"}
}
- {end_date:date(date)
- {label "End date (dd/mm/yyyy)" }
- {help_text "From this date the room will be closed"}
- }
{max_p:text(text)
- {label "Maximal participants"}
- {help_text "Maximal number of participants in this room"}
-
- }
+ {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 "Rss_service" }
+ {label "#chat.rss_service#" }
{options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
- {help_text "Sindicate into RSS"}
+ {help_text "[_ chat.rss_syndication]"}
}
- {frequency:boolean(select),optional
- {label "frequency" }
- {options {{"daily"} {"monthly" } {"weekly" }}}
- {help_text "Frecuency of RSS service"}
+ {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 "Mail_service" }
+ {label "#chat.mail_service#" }
{options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
- {help_text "Receive brief mails"}
+ {help_text "[_ chat.receive_mails]"}
}
- {frequency2:boolean(select),optional
- {label "frequency" }
- {options {{"daily"} {"monthly" } {"weekly" }}}
- {help_text "Frecuency of mail service"}
- }
+ {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}}}
-
}
{archive_p:boolean(radio)
{label "#chat.Archive#" }
{options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
- }
- {moderated:boolean(radio)
- {label "Moderated" }
- {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
-
}
# {auto_flush_p:boolean(radio)
# {label "#chat.AutoFlush#" }
@@ -121,24 +149,76 @@
} -edit_data {
-} -after_submit {
- set date [lrange $end_date 0 2]
+} -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 \
-active_p $active_p \
-archive_p $archive_p \
-user_id [ad_conn user_id] \
-room_id $room_id \
$description $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]
+ }
+ }
+ }
+
+ }
+ }
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.5 -r1.6
--- openacs-4/packages/chat/www/room-enter.tcl 26 Oct 2006 11:11:20 -0000 1.5
+++ openacs-4/packages/chat/www/room-enter.tcl 7 Jun 2007 09:14:25 -0000 1.6
@@ -9,6 +9,7 @@
} {
room_id:integer,notnull
client:trim
+
}
set user_id [ad_conn user_id]
Index: openacs-4/packages/chat/www/room-new-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-new-2.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/chat/www/room-new-2.tcl 26 Oct 2006 13:03:59 -0000 1.5
+++ openacs-4/packages/chat/www/room-new-2.tcl 7 Jun 2007 09:14:25 -0000 1.6
@@ -2,7 +2,7 @@
ad_page_contract {
Add a new room to the database.
- @author David Dao (ddao@arsdigita.com)
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
@creation-date November 15, 2000
@cvs-id $Id$
} {
Index: openacs-4/packages/chat/www/room-new-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-new-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/room-new-postgresql.xql 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,127 @@
+
+
+
+ postgresql7.1
+
+
+
+ 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 distinct '$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_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
+
+
+
\ No newline at end of file
Index: openacs-4/packages/chat/www/room-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-new.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/chat/www/room-new.tcl 26 Oct 2006 13:03:59 -0000 1.5
+++ openacs-4/packages/chat/www/room-new.tcl 7 Jun 2007 09:14:25 -0000 1.6
@@ -2,10 +2,9 @@
ad_page_contract {
Display a form to create a new room.
- @author David Dao (ddao@arsdigita.com)
- @creation-date November 13, 2000
- @cvs-id $Id$
-} {
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
+
+} {
} -properties {
context_bar:onevalue
room_id:onevalue
@@ -34,58 +33,59 @@
set key_words ""
set alias ""
set Rss_service ""
-set frequency [list daily monthly weekly]
+set freq {{"daily"} {"monthly" } {"weekly" }}
+
ad_form -name "room-entry" -edit_buttons [list [list [_ chat.Create_room] next]] -has_edit 1 -form {
{pretty_name:text(text)
{label "#chat.Room_name#" }
{title "Name of the room"}
}
{alias:text(text)
- {label "Alias" }
- {help_text "Alias in this room"}
+ {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 "Key words" }
+ {label "#chat.keywords#" }
{html {rows 3 cols 25}}
- {help_text "Main words of the room, in order to describe it"}
+ {help_text "[_ chat.main_words]"}
}
{maxP:text(text)
- {label "Maximal participants" }
- {help_text "Maximal number of participants in this room"}
+ {label "#chat.maximal_partitipants#" }
+ {help_text "[_ chat.maximal_number_partitipants]"}
}
{end_date:date(date)
- {label "End date (dd/mm/yyyy)" }
- {help_text "From this date the room will be closed"}
+ {label "#chat.end_date#" }
+ {help_text "[_ chat.end_date_description]"}
}
{Rss_service:boolean(radio)
- {label "Rss_service" }
+ {label "#chat.rss_service#" }
{options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
- {help_text "Sindicate into RSS"}
+ {help_text "[_ chat.rss_syndication]"}
}
- {frequency1:boolean(select),optional
- {label "Frequency Rss" }
- {options {{"daily"} {"monthly" } {"weekly" }}}
- {help_text "Frecuency of RSS service"}
+ {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 "Mail_service" }
+ {label "#chat.mail_service#" }
{options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
- {help_text "Receive brief mails"}
+ {help_text "[_ chat.receive_mails]"}
}
- {frequency2:boolean(select),optional
- {label "Frequency Mail" }
- {options {{"daily"} {"monthly" } {"weekly" }}}
- {help_text "Frecuency of mail service"}
+ {frequency2:text(select),optional
+ {label "#chat.frequency_mail#" }
+ {options {{"daily" dayly} {"weekly" weekly} {"monthly" monthly}}}
+ {help_text "[_ chat.frequency_mail_description]"}
}
- {moderated_p:boolean(radio)
- {label "Moderated" }
- {options {{"#acs-kernel.common_Yes#" t} {"#acs-kernel.common_no#" f}}}
- }
+ # {moderated_p: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}}}
@@ -111,43 +111,142 @@
set comm_id 0
} else {
set comm_id [dotlrn_community::get_community_id]
- }
- if {[catch {set room_id [chat_room_new \
- -alias $alias \
- -key_words $key_words \
- -maxP $maxP \
- -end_date $date \
- -Rss_service $Rss_service \
- -Mail_service $Mail_service \
- -moderated_p $moderated_p \
- -active_p $active_p \
- -archive_p $archive_p \
- -auto_flush_p t \
- -auto_transcript_p t \
- -context_id [ad_conn package_id] \
- -comm_id $comm_id \
- -creation_user [ad_conn user_id] \
- -creation_ip [ad_conn peeraddr] \
- $description $pretty_name]} errmsg]} {
+ }
+
+ # frequency1: rss frequency
+ # frequency2: mail frequency
+ if {[catch {set room_id [chat_room_new \
+ -alias $alias \
+ -key_words $key_words \
+ -maxP $maxP \
+ -end_date $date \
+ -Rss_service $Rss_service \
+ -frequency1 $frequency1 \
+ -frequency2 $frequency2 \
+ -Mail_service $Mail_service \
+ -moderated_p $moderated_p \
+ -active_p $active_p \
+ -archive_p $archive_p \
+ -auto_flush_p t \
+ -auto_transcript_p t \
+ -context_id [ad_conn package_id] \
+ -comm_id $comm_id \
+ -creation_user [ad_conn user_id] \
+ -creation_ip [ad_conn peeraddr] \
+ $description $pretty_name]} errmsg]} {
ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg"
break
}
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
+ set sender_id [ad_conn 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
+
+ }
+ set from $sender_email
+ set community_id [dotlrn_community::get_community_id]
+ 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_info2]
+
} 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
+ 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_info]
+ }
+
+
+ set send_date [template::util::date::now_min_interval]
+
+
+ set subject "$pretty_name chat room created"
+ set message "It has been created a new room, whose name is $pretty_name. It belongs to $community_name community. You can use it to talk about."
+ set message_type "text"
+
+
+ set package_id [ad_conn package_id]
+
+ db_1row select_sender_info4 {
+ select count(acs.impl_name) as count
+ from acs_sc_impls acs
+ where acs.impl_name = 'chat_rss'
}
- ad_returnredirect "room?room_id=$room_id"
- ad_script_abort
+
+ set subscr_id [rss_support::add_subscription \
+ -summary_context_id $room_id \
+ -impl_name "chat_rss" \
+ -owner "chat" \
+ -lastbuild "now"]
+ rss_gen_report $subscr_id
+
+
+ if { $frequency1 eq "dayly" } {
+ ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 01 00] chat_update_rss $room_id
+ }
+ if { $frequency1 eq "weekly" } {
+ ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 0 01 00] chat_update_rss $room_id
+ }
+ if { $frequency1 eq "monthly" } {
+ set week 1
+ ad_schedule_proc -thread t -schedule_proc ns_schedule_weekly [list 0 01 00] chat_update_rss_monthly $room_id $week
+ }
+
+
+
+ set user_id [ad_conn user_id]
+
+
+ if { $Mail_service eq "t"} {
+ 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"
+ }
+ }
+
+ bulk_mail::new \
+ -package_id [site_node_apm_integration::get_child_package_id -package_key [bulk_mail::package_key]] \
+ -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 {$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
+ }
+ ad_returnredirect "room?room_id=$room_id"
+ ad_script_abort
}
ad_return_template "room-entry"
Index: openacs-4/packages/chat/www/room-search-2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-search-2.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/room-search-2.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,5 @@
+
+#chat.Room_name#
+#chat.Rooms_found#"
+
+
\ No newline at end of file
Index: openacs-4/packages/chat/www/room-search-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-search-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/room-search-2.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,183 @@
+ad_page_contract {
+ Display a form to create a new room.
+
+ @author Pablo Mu�oz (pablomp@tid.es)
+} {
+ pretty_name
+ date2
+ partitipants
+ key_words
+ sent_files
+ sent_files_title
+}
+#set transcript_delete_p [permission::permission_p -object_id $room_id -privilege chat_transcript_delete]
+#set transcript_view_p [permission::permission_p -object_id $room_id -privilege chat_transcript_view]
+
+set query ""
+set query1 ""
+set query2 ""
+set query3 ""
+set query4 ""
+set query5 ""
+set query6 ""
+
+
+
+#append query "select distinct cr.pretty_name, cr.description,cr.comm_name,cr.creator,ao.creation_date,cr.room_id
+# from chat_partitipants_transcript ptr,chat_transcripts ct,acs_objects ao, chat_keywords as ck, chat_rooms_files_sent fs, chat_rooms cr where"
+
+append query "select distinct cr.pretty_name, cr.description,cr.comm_name,cr.creator,ao.creation_date,cr.room_id
+from acs_objects ao, chat_rooms cr"
+
+
+
+if { !($partitipants eq "") } {
+ append query ",chat_partitipants_transcript ptr"
+}
+if { !($sent_files_title eq "") } {
+ append query ",chat_rooms_files_sent fs"
+}
+if { !($sent_files eq "") } {
+ if { $sent_files_title eq "" } {
+ append query ",chat_rooms_files_sent fs"
+ }
+}
+if { !($key_words eq "") } {
+ append query ",chat_keywords ck"
+}
+
+
+if { !($pretty_name eq "") } {
+ set query1 " where cr.pretty_name = :pretty_name"
+
+}
+if {!($date2 eq "") } {
+ if { !($pretty_name eq "") } {
+ set query2 " and cr.end_date = :date2 "
+
+ } else {
+ set query2 " where cr.end_date = :date2 "
+
+ }
+}
+if { !($partitipants eq "") } {
+ if { !($pretty_name eq "") || !($date2 eq "")} {
+ set query3 " and ptr.partitipant = :partitipants and ptr.transcript_id = ct.transcript_id and ct.room_id = cr.room_id"
+
+ } else {
+ set query3 " where ptr.partitipant = :partitipants and ptr.transcript_id = ct.transcript_id and ct.room_id = cr.room_id "
+
+ }
+}
+if { !($sent_files_title eq "") } {
+ if { !($pretty_name eq "") || !($date2 eq "") || !($partitipants eq "") } {
+ set query4 " and fs.title = :sent_files_title and fs.room_id = cr.room_id"
+
+ } else {
+ set query4 " where fs.title = :sent_files_title and fs.room_id = cr.room_id "
+
+ }
+}
+if { !($sent_files eq "") } {
+ if { !($pretty_name eq "") || !($date2 eq "") || !($partitipants eq "") || !($sent_files_title eq "") } {
+
+ set query5 " and fs.file = :sent_files and fs.room_id = cr.room_id"
+
+ } else {
+
+ set query5 " where fs.file = :sent_files and fs.room_id = cr.room_id "
+
+ }
+}
+if { !($key_words eq "") } {
+ if { !($pretty_name eq "") || !($date2 eq "") || !($partitipants eq "") || !($sent_files_title eq "") || !($sent_files eq "") } {
+
+ set query6 " and ck.keyword = :key_words and ck.room_id = cr.room_id"
+
+ } else {
+
+ set query6 " where ck.keyword = :key_words and ck.room_id = cr.room_id "
+
+ }
+}
+set creation_date ""
+set query7 " and cr.room_id = ao.object_id
+ order by ao.creation_date desc"
+set queryT [concat $query $query1 $query2 $query3 $query4 $query5 $query6 $query7]
+#$date2
+#$queryT
+db_multirow -extend { creation_date_pretty creator_name admin_p user_p path path2 path3 path4} chat_room *SQL* $queryT {
+ set path ""
+ set path2 ""
+ set path3 ""
+ set path4 ""
+ set creation_date_pretty [lc_time_fmt $creation_date "%q %X"]
+ db_1row room_info {
+ select p.first_names as first_names, p.last_name as last_name
+ from persons p
+ where p.person_id = :creator
+ }
+ append msg_creator1 $first_names " "
+ append creator_name $msg_creator1 $last_name
+ set user_id [ad_conn user_id]
+ db_1row room_info {
+ select acs_permission__permission_p(room_id, :user_id, 'chat_room_admin') as admin_p,
+ (select site_node__url(site_nodes.node_id)
+ from site_nodes
+ where site_nodes.object_id = obj.context_id) as base_url,
+ acs_permission__permission_p(room_id, :user_id, 'chat_read') as user_p
+ from chat_rooms rm, acs_objects obj
+ where rm.room_id = obj.object_id
+ and rm.room_id = :room_id
+ }
+ append path $base_url "options?action=&room_id=$room_id"
+ append path2 $base_url "chat-transcripts?room_id=$room_id"
+ append path3 $base_url "room?room_id=$room_id"
+ append path4 $base_url "chat-transcripts?room_id=$room_id"
+
+
+}
+
+
+
+list::create \
+ -name "chat_room" \
+ -multirow "chat_room" \
+ -elements {
+ pretty_name {
+ label "#chat.Name#"
+ html { style "text-align:center;" }
+ link_url_eval {chat?room_id=$room_id&client=ajax}
+ }
+ description {
+ label "#chat.Description#"
+ html { style "text-align:center;" }
+ }
+ creator_name {
+ label "#chat.room_creator2#"
+ html { style "text-align:center;" }
+ }
+ comm_name {
+ label "#chat.comm_name2#"
+ html { style "text-align:center;" }
+ }
+ creation_date_pretty {
+ label "#chat.creation_date#"
+ }
+ admin {
+ label "#chat.actions#"
+ html { align "center" }
+ display_template {
+
+ \n#chat.room_change_options#
+
+ \n#chat.Transcripts#
+
+
+ \n#chat.room_admin#
+
+ \n#chat.Transcripts#
+
+ }
+ }
+ }
\ No newline at end of file
Index: openacs-4/packages/chat/www/room-search.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-search.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/room-search.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+@title;noquote@
+
+
+
\ No newline at end of file
Index: openacs-4/packages/chat/www/room-search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-search.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/room-search.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,54 @@
+ad_page_contract {
+ In order to search a room
+
+ @author Pablo Mu�oz (pablomp@tid.es)
+} {
+ package_id:integer
+}
+
+
+set title "[_ chat.search_room]"
+set action "room-search-2"
+set pretty_name ""
+set description ""
+set key_words ""
+set date ""
+set partitipants ""
+set reg_users ""
+set sent_files ""
+set submit_label "[_ chat.search_room]"
+
+ad_form -name "room-search" -edit_buttons [list [list [_ chat.search_room] next]] -has_edit 1 -form {
+ {package_id:key}
+ {pretty_name:text(text),optional
+ {label "#chat.Room_name#" }
+ }
+ {date:date(date),optional
+ {label "#chat.end_date#" }
+ }
+ {partitipants:text,optional
+ {label "#chat.partitipants2#" }
+ {html {rows 3 cols 25}}
+ }
+ {key_words:text,optional
+ {label "#chat.keyword#" }
+ {html {rows 3 cols 25}}
+ }
+ {sent_files:text,optional
+ {label "#chat.files_sent2#" }
+ {html {rows 3 cols 25}}
+ }
+ {sent_files_title:text,optional
+ {label "#chat.files_sent4#" }
+ {html {rows 3 cols 25}}
+ }
+} -edit_request {
+
+} -edit_data {
+
+} -after_submit {
+ set date2 [lrange $date 0 2]
+ ad_returnredirect "room-search-2?pretty_name=$pretty_name&date2=$date2&partitipants=$partitipants&key_words=$key_words&sent_files=$sent_files&sent_files_title=$sent_files_title"
+ ad_script_abort
+}
+ad_return_template "room-search"
Index: openacs-4/packages/chat/www/room.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/chat/www/room.tcl 26 Oct 2006 11:11:20 -0000 1.5
+++ openacs-4/packages/chat/www/room.tcl 7 Jun 2007 09:14:25 -0000 1.6
@@ -1,9 +1,8 @@
#/www/chat/room.tcl
ad_page_contract {
Display information about chat room.
- @author David Dao (ddao@arsdigita.com)
- @creation-date November 15, 2000
- @cvs-id $Id$
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
+
} {
room_id:integer,notnull
} -properties {
@@ -32,7 +31,32 @@
}
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.
###
@@ -43,10 +67,10 @@
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.
###
Index: openacs-4/packages/chat/www/rss.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/rss.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/rss.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,43 @@
+
+ad_page_contract {
+
+ Setup or remove rss feed
+
+ @author Dave Bauer (dave@thedesignexperience.org) and Pablo Mu�oz(pablomp@tid.es)
+
+} {
+ room_id
+} -properties {
+} -validate {
+} -errors {
+}
+
+set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
+permission::require_permission \
+ -object_id $package_id \
+ -party_id $user_id \
+ -privilege "admin"
+
+if {[rss_support::subscription_exists \
+ -summary_context_id $room_id \
+ -impl_name chat_rss]} {
+ #deactivate rss
+
+ rss_support::del_subscription \
+ -summary_context_id $room_id \
+ -impl_name "chat_rss" \
+ -owner "chat"
+ set message "RSS feed deactivated"
+} else {
+ #activate rss
+ set subscr_id [rss_support::add_subscription \
+ -summary_context_id $room_id \
+ -impl_name "chat_rss" \
+ -lastbuild "now" \
+ -owner "chat"]
+ rss_gen_report $subscr_id
+ set message "RSS feed activated"
+}
+
+ad_returnredirect -message $message "./"
\ No newline at end of file
Index: openacs-4/packages/chat/www/rss_subscripcion.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/rss_subscripcion.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/rss_subscripcion.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,15 @@
+
+Rss Syndication
+
+
+ #rss-support.Syndication_Feed#
+
+
\ No newline at end of file
Index: openacs-4/packages/chat/www/rss_subscripcion.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/rss_subscripcion.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/rss_subscripcion.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,18 @@
+ad_page_contract {
+
+ Display a list of news items summary for administration
+
+ @author Stefan Deusch (stefan@arsdigita.com)
+ @creation-date 2000-12-20
+ @cvs-id $Id: rss_subscripcion.tcl,v 1.1 2007/06/07 09:14:25 pablom Exp $
+
+} {
+ room_id
+}
+set package_id [ad_conn package_id]
+
+set rss_exists [rss_support::subscription_exists \
+ -summary_context_id $room_id \
+ -impl_name chat_rss]
+
+set rss_feed_url [chat_util_get_url $package_id]rss/rss.tcl?room_id=$room_id
\ No newline at end of file
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.2 -r1.3
--- openacs-4/packages/chat/www/search-3.tcl 24 Jun 2006 14:23:42 -0000 1.2
+++ openacs-4/packages/chat/www/search-3.tcl 7 Jun 2007 09:14:25 -0000 1.3
@@ -1,16 +1,55 @@
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 {
- ad_require_permission $room_id chat_user_ban
+
+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
+}
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.5 -r1.6
--- openacs-4/packages/chat/www/transcript-edit-2.tcl 8 Aug 2006 21:26:20 -0000 1.5
+++ openacs-4/packages/chat/www/transcript-edit-2.tcl 7 Jun 2007 09:14:25 -0000 1.6
@@ -11,6 +11,7 @@
contents:html,notnull
room_id:notnull,integer
{description:trim ""}
+ {keywords:trim ""}
}
permission::require_permission -object_id $transcript_id -privilege chat_transcript_edit
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.4 -r1.5
--- openacs-4/packages/chat/www/transcript-edit.tcl 24 Jun 2006 14:23:42 -0000 1.4
+++ openacs-4/packages/chat/www/transcript-edit.tcl 7 Jun 2007 09:14:25 -0000 1.5
@@ -2,9 +2,8 @@
ad_page_contract {
Retrieve transcript content.
- @author David Dao (ddao@arsdigita.com)
- @creation-date November 28, 2000
- @cvs-id $Id$
+ @author David Dao (ddao@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
+
} {
transcript_id:integer,notnull
room_id:integer,notnull
@@ -17,11 +16,20 @@
set active_p [room_active_status $room_id]
db_1row get_transcript_info {
- select pretty_name, description, contents
- from chat_transcripts
- where transcript_id = :transcript_id
+ select ct.pretty_name, ct.description, ct.contents
+ from chat_transcripts ct
+ 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}
@@ -38,14 +46,21 @@
{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 6 cols 65}}
+ {html {rows 3 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.6 -r1.7
--- openacs-4/packages/chat/www/transcript-entry.adp 24 Jun 2006 14:23:42 -0000 1.6
+++ openacs-4/packages/chat/www/transcript-entry.adp 7 Jun 2007 09:14:25 -0000 1.7
@@ -43,6 +43,10 @@
|
+ #chat.keywords#
+ |
+ |
+
#chat.Contents#
| @contents;noquote@
|
Index: openacs-4/packages/chat/www/transcript-new-2-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-new-2-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/transcript-new-2-postgresql.xql 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+postgresql7.1
+
+
+
+ select chat_room__store_transcripts_keywords (
+ :word,
+ :transcript_id
+ )
+
+
+
+
+ select chat_room__store_transcripts_keywords (
+ :word,
+ :transcript_id
+ )
+
+
+
+
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.2 -r1.3
--- openacs-4/packages/chat/www/transcript-new-2.tcl 24 Jun 2006 14:23:42 -0000 1.2
+++ openacs-4/packages/chat/www/transcript-new-2.tcl 7 Jun 2007 09:14:25 -0000 1.3
@@ -1,10 +1,12 @@
#/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
@@ -24,6 +26,15 @@
$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
@@ -34,5 +45,19 @@
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.4 -r1.5
--- openacs-4/packages/chat/www/transcript-new.tcl 24 Jun 2006 14:23:42 -0000 1.4
+++ openacs-4/packages/chat/www/transcript-new.tcl 7 Jun 2007 09:14:25 -0000 1.5
@@ -1,6 +1,7 @@
#/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 {
@@ -14,7 +15,23 @@
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]"]
@@ -26,10 +43,35 @@
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 {} {
- append contents "\[$creation_date\] [chat_user_name $creation_user]: $msg
\n"
+
+ 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"
+ }
+ }
}
ad_return_template "transcript-entry"
Index: openacs-4/packages/chat/www/transcript-search.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-search.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/transcript-search.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+@title;noquote@
+
+
+
\ No newline at end of file
Index: openacs-4/packages/chat/www/upload.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/upload.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/upload.adp 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,9 @@
+
+Send a file
+@context;noquote@
+
+
+
+
+
+
Index: openacs-4/packages/chat/www/upload.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/upload.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/upload.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,278 @@
+ad_page_contract {
+ page to add a new file to the system
+
+ @author Kevin Scaldeferri (kevin@arsdigita.com)
+ @creation-date 6 Nov 2000
+ @cvs-id $Id: upload.tcl,v 1.1 2007/06/07 09:14:25 pablom Exp $
+} {
+ file_id:integer,optional,notnull
+ folder_id:integer,optional,notnull
+ upload_file:trim,optional
+ return_url:optional
+ chat_id:optional
+ upload_file.tmpfile:tmpfile,optional
+ content_body:optional
+ {title ""}
+ {lock_title_p 0}
+ {name ""}
+
+} -properties {
+ folder_id:onevalue
+ context:onevalue
+ title:onevalue
+ lock_title_p:onevalue
+} -validate {
+ file_id_or_folder_id {
+ if {[exists_and_not_null file_id] && ![exists_and_not_null folder_id]} {
+ set folder_id [db_string get_folder_id "select parent_id as folder_id from cr_items where item_id=:file_id;" -default ""]
+ }
+ if {![fs_folder_p $folder_id]} {
+ ad_complain "The specified parent folder is not valid."
+ }
+ }
+ max_size -requires {upload_file} {
+ set n_bytes [file size ${upload_file.tmpfile}]
+ set max_bytes "1000000"
+ if { $n_bytes > $max_bytes } {
+ ad_complain "Your file is larger than the maximum file size allowed on this system ([util_commify_number $max_bytes] bytes)"
+ }
+ }
+}
+
+set title ""
+set description ""
+
+set user_id [ad_conn user_id]
+#set package_id [ad_conn package_id]
+
+
+db_1row room_info {
+ select distinct apm.package_id as package_id
+ from apm_packages as apm
+ where apm.package_key = 'file-storage'
+ and apm.instance_name = 'User Folders'
+ }
+
+# check for write permission on the folder or item
+
+permission::require_permission \
+ -object_id $folder_id \
+ -party_id $user_id \
+ -privilege "write"
+
+if {![ad_form_new_p -key file_id]} {
+ permission::require_permission \
+ -object_id $file_id \
+ -party_id $user_id \
+ -privilege "write"
+ set context [fs_context_bar_list -final "[_ file-storage.Add_Revision]" $folder_id]
+
+} else {
+ set context [fs_context_bar_list -final "[_ file-storage.Add_File]" $folder_id]
+}
+
+ad_form -html { enctype multipart/form-data } -export { folder_id lock_title_p name } -form {
+ file_id:key
+ {upload_file:file {label \#file-storage.Upload_a_file\#} {html "size 30"}}
+}
+
+if {[parameter::get -parameter AllowTextEdit -default 0]} {
+ if {[ad_form_new_p -key file_id]} {
+
+ # To allow the creation of files
+ ad_form -extend -form {
+ {content_body:richtext(richtext),optional
+ {label "Create a file"}
+ {html "rows 20 cols 70" }
+ {htmlarea_p 1}
+ }
+ }
+ } else {
+ # To make content editable
+ set revision_id [content::item::get_live_revision -item_id $file_id]
+ set mime_type [db_string get_mime_type "select mime_type from cr_revisions where revision_id = :revision_id"]
+ if { [string equal $mime_type "text/html"] } {
+ ad_form -extend -form {
+ {edit_content:richtext(richtext),optional
+ {label "Content"}
+ {html "rows 20 cols 70" }
+ {htmlarea_p 1}
+ }
+ {mime_type:text(hidden)
+ {value $mime_type}
+ }
+ }
+ }
+ }
+}
+
+if {[exists_and_not_null return_url]} {
+ ad_form -extend -form {
+ {return_url:text(hidden) {value $return_url}}
+ }
+}
+
+if {[exists_and_not_null chat_id]} {
+ ad_form -extend -form {
+ {chat_id:text(hidden) {value $chat_id}}
+ }
+}
+
+if {$lock_title_p} {
+ ad_form -extend -form {
+ {title:text(hidden) {value $title}}
+ }
+} else {
+ ad_form -extend -form {
+ {title:text {label \#file-storage.Title\#} {html {size 30}} }
+ }
+}
+
+ad_form -extend -form {
+ {description:text(textarea) {label \#file-storage.Description\#} {html "rows 5 cols 35"}}
+
+}
+
+
+ad_form -extend -form {} -select_query_name {get_file} -new_data {
+
+ set upload_files [list [template::util::file::get_property filename $upload_file]]
+ set upload_tmpfiles [list [template::util::file::get_property tmp_filename $upload_file]]
+
+ set mime_type ""
+ if { [empty_string_p [lindex $upload_files 0]]} {
+ if {[parameter::get -parameter AllowTextEdit -default 0] && [empty_string_p [template::util::richtext::get_property html_value $content_body]] } {
+ ad_return_complaint 1 "You have to upload a file or create a new one"
+ ad_script_abort
+ }
+ # create a tmp file to import from user entered HTML
+ set content_body [template::util::richtext::get_property html_value $content_body]
+ set mime_type text/html
+ set tmp_filename [ns_tmpnam]
+ set fd [open $tmp_filename w]
+ puts $fd $content_body
+ close $fd
+ set upload_files [list $title]
+ set upload_tmpfiles [list $tmp_filename]
+ }
+ ns_log notice "file_add mime_type='${mime_type}'"
+ set i 0
+ set number_upload_files [llength $upload_files]
+ foreach upload_file $upload_files tmpfile $upload_tmpfiles {
+ set this_file_id $file_id
+ set this_title $title
+ set mime_type [cr_filename_to_mime_type -create -- $upload_file]
+ # upload a new file
+ # if the user choose upload from the folder view
+ # and the file with the same name already exists
+ # we create a new revision
+
+ if {[string equal $this_title ""]} {
+ set this_title $upload_file
+ }
+
+ if {![empty_string_p $name]} {
+ set upload_file $name
+ }
+
+ set existing_item_id [fs::get_item_id -name $upload_file -folder_id $folder_id]
+
+ if {![empty_string_p $existing_item_id]} {
+ # file with the same name already exists
+ # in this folder, create a new revision
+ set this_file_id $existing_item_id
+ permission::require_permission \
+ -object_id $this_file_id \
+ -party_id $user_id \
+ -privilege write
+ }
+
+ set revision_id [fs::add_file \
+ -name $upload_file \
+ -item_id $this_file_id \
+ -parent_id $folder_id \
+ -tmp_filename $tmpfile\
+ -creation_user $user_id \
+ -creation_ip [ad_conn peeraddr] \
+ -title $this_title \
+ -description $description \
+ -package_id $package_id \
+ -mime_type $mime_type]
+
+ file delete $tmpfile
+ incr i
+ if {$i < $number_upload_files} {
+ set file_id [db_nextval "acs_object_id_seq"]
+ }
+ }
+ file delete $upload_file.tmpfile
+} -edit_data {
+ set this_title $title
+ set filename [template::util::file::get_property filename $upload_file]
+ if {[string equal $this_title ""]} {
+ set this_title $filename
+ }
+
+ set revision_id [fs::add_version \
+ -name $filename \
+ -tmp_filename [template::util::file::get_property tmp_filename $upload_file] \
+ -item_id $file_id \
+ -creation_user $user_id \
+ -creation_ip [ad_conn peeraddr] \
+ -title $this_title \
+ -description $description \
+ -package_id $package_id]
+
+} -after_submit {
+
+ if { $description eq "" } {
+ set description $upload_file
+ if { $title eq "" } {
+ set title $upload_file
+ }
+ }
+ set creation_user [ad_conn user_id]
+ set creation_ip [ad_conn peeraddr]
+ set context_id [ad_conn package_id]
+ set date [clock format [clock seconds] -format {%D} ]
+
+ set send_file [send_file $chat_id $upload_file $title $description $date $context_id $creation_user $creation_ip $revision_id]
+
+ db_1row room_info2 {
+ select count(r.alias)
+ from chat_registered_users r
+ where r.user_id = :creation_user
+ and r.room_id = :chat_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 = :chat_id
+ }
+ set post [chat_message_post $chat_id -1 "The file '$title' has been sent by the user $alias" "1"]
+ } else {
+ set post [chat_message_post $chat_id -1 "The file '$title' has been sent by the user [chat_user_name $creation_user]" "1"]
+ }
+
+
+
+
+
+ if {[exists_and_not_null return_url]} {
+ ad_returnredirect $return_url
+ } else {
+ ad_returnredirect "./?[export_url_vars folder_id]"
+ }
+ ad_script_abort
+
+}
+
+# if title isn't passed in ignore lock_title_p
+if {[empty_string_p $title]} {
+ set lock_title_p 0
+}
+
+ad_return_template
Index: openacs-4/packages/chat/www/admin/rss.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/admin/Attic/rss.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/admin/rss.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,44 @@
+#
+
+ad_page_contract {
+
+ Setup or remove rss feed
+
+ @author Dave Bauer (dave@thedesignexperience.org) and Pablo Mu�oz (pablomp@tid.es)
+ @creation-date 2005-01-23
+ @arch-tag: 4ff5628c-77f1-40ef-86c7-ef247a1ffe4f
+ @cvs-id $Id: rss.tcl,v 1.1 2007/06/07 09:14:25 pablom Exp $
+} {
+} -properties {
+} -validate {
+} -errors {
+}
+
+set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
+permission::require_permission \
+ -object_id $package_id \
+ -party_id $user_id \
+ -privilege "admin"
+
+if {[rss_support::subscription_exists \
+ -summary_context_id $package_id \
+ -impl_name chat]} {
+ #deactivate rss
+ rss_support::del_subscription \
+ -summary_context_id $package_id \
+ -impl_name "chat_rss" \
+ -owner "chat"
+ set message "RSS feed deactivated"
+} else {
+ #activate rss
+ set subscr_id [rss_support::add_subscription \
+ -summary_context_id $package_id \
+ -impl_name "chat_rss" \
+ -lastbuild "now" \
+ -owner "chat"]
+ rss_gen_report $subscr_id
+ set message "RSS feed activated"
+}
+
+ad_returnredirect "../rss/rss.xml"
\ No newline at end of file
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.2 -r1.3
--- openacs-4/packages/chat/www/ajax/chat.js 24 Jun 2006 14:23:42 -0000 1.2
+++ openacs-4/packages/chat/www/ajax/chat.js 7 Jun 2007 09:14:25 -0000 1.3
@@ -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,68 +80,144 @@
}
function pushReceiver(content) {
- updateReceiver(content);
+ //alert(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;
- var messagesDiv = frames['ichat'].document.getElementById('messages');
- messagesReceiver(messagesNode,messagesDoc,messagesDiv);
+ 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
}
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');
- td.innerHTML = decodeURIComponent(e[0].firstChild.nodeValue.replace(/\+/g,' '));
+ 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.className = 'user';
- tr.appendChild(td);
+ tr.appendChild(td);
+
td = doc.createElement('td');
- td.innerHTML = decodeURIComponent(e[1].firstChild.nodeValue.replace(/\+/g,' '));
+ td.innerHTML = decodeURIComponent(e[2].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 = {
@@ -152,10 +228,14 @@
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() {
@@ -165,6 +245,7 @@
},
httpReceiver: function(obj) {
+ // alert('httpReceiver');
if (obj.connection.readyState == 4) {
if (obj.connection.status == 200) {
obj.handler(obj.connection.responseText);
@@ -177,6 +258,7 @@
},
chatSendMsg: function(send_url) {
+ //alert('chatSendMsg');
// if (inactivityTimeout) {
// clearTimeout(inactivityTimeout);
// alert("Clearing inactivityTimeout");
@@ -189,9 +271,11 @@
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#';
@@ -211,6 +295,10 @@
}
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;
@@ -222,7 +310,9 @@
}
function updateDataConnections() {
+ //alert('updateDataConnections');
for (var ds in dataConnections) {
+ //alert(ds);
if (dataConnections[ds].autoConnect) {
// alert("updating " + dataConnections[ds].url);
dataConnections[ds].updateBackground();
@@ -239,11 +329,15 @@
}
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.2 -r1.3
--- openacs-4/packages/chat/www/ajax/chat.tcl 24 Jun 2006 14:23:42 -0000 1.2
+++ openacs-4/packages/chat/www/ajax/chat.tcl 7 Jun 2007 09:14:25 -0000 1.3
@@ -1,16 +1,49 @@
ad_page_contract {
a tiny chat client
- @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at)
- @creation-date Jan 31, 2006
- @cvs-id $Id$
+ @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) and Pablo Mu�oz (pablomp@tid.es)
+
} -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 "\
@@ -19,9 +52,58 @@
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 {
@@ -43,13 +125,26 @@
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."}
}
@@ -64,17 +159,25 @@
#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 "
"
Index: openacs-4/packages/chat/www/ajax/files.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/ajax/Attic/files.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/ajax/files.tcl 7 Jun 2007 09:14:25 -0000 1.1
@@ -0,0 +1,23 @@
+ad_page_contract {
+ realtime file list for a chat room
+
+ @author Pablo Mu�oz (pablomp@tid.es)
+ @creation-date Dec 13, 2006
+} -query {
+ id
+ s
+}
+
+::chat::Chat c1 -volatile -chat_id $id -session_id $s
+set output [c1 get_files]
+
+ns_return 200 text/html "
+
+
+
+
+
+"
\ No newline at end of file
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax/users.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/chat/www/resources/chatpicture.jpg
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/resources/Attic/chatpicture.jpg,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/www/resources/xml.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/resources/Attic/xml.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/chat/www/rss/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/rss/Attic/index.vuh,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/rss/index.vuh 7 Jun 2007 09:14:26 -0000 1.1
@@ -0,0 +1,2 @@
+set package_id [ad_conn package_id]
+rp_internal_redirect /rss/chat_rss/${package_id}/rss.xml
\ No newline at end of file
Index: openacs-4/packages/chat/www/rss/rss.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/rss/Attic/rss.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat/www/rss/rss.tcl 7 Jun 2007 09:14:26 -0000 1.1
@@ -0,0 +1,13 @@
+ad_page_contract {
+
+ Display a list of news items summary for administration
+
+ @author Stefan Deusch (stefan@arsdigita.com) and Pablo Mu�oz(pablomp@tid.es)
+
+
+} {
+ room_id
+}
+
+
+rp_internal_redirect /rss/chat_rss/${room_id}/rss.xml
\ No newline at end of file
Index: openacs-4/packages/chat-portlet/chat-portlet.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/chat-portlet.info,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat-portlet/chat-portlet.info 15 May 2007 20:14:23 -0000 1.4
+++ openacs-4/packages/chat-portlet/chat-portlet.info 7 Jun 2007 09:19:11 -0000 1.5
@@ -7,14 +7,14 @@
f
t
-
+
OpenACS
- 2007-04-22
+ 2006-07-31
OpenACS
-
-
-
+
+
+
Index: openacs-4/packages/chat-portlet/catalog/chat-portlet.ca_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/catalog/chat-portlet.ca_ES.ISO-8859-1.xml,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat-portlet/catalog/chat-portlet.ca_ES.ISO-8859-1.xml 15 May 2007 20:14:24 -0000 1.4
+++ openacs-4/packages/chat-portlet/catalog/chat-portlet.ca_ES.ISO-8859-1.xml 7 Jun 2007 09:19:12 -0000 1.5
@@ -1,5 +1,5 @@
-
+
Afegeix una sala de xat
Administraci� de xat
Index: openacs-4/packages/chat-portlet/catalog/chat-portlet.de_DE.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/catalog/chat-portlet.de_DE.ISO-8859-1.xml,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat-portlet/catalog/chat-portlet.de_DE.ISO-8859-1.xml 15 May 2007 20:14:24 -0000 1.4
+++ openacs-4/packages/chat-portlet/catalog/chat-portlet.de_DE.ISO-8859-1.xml 7 Jun 2007 09:19:12 -0000 1.5
@@ -1,5 +1,5 @@
-
+
Add a chat room
Chat administration
Index: openacs-4/packages/chat-portlet/catalog/chat-portlet.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/catalog/chat-portlet.en_US.ISO-8859-1.xml,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat-portlet/catalog/chat-portlet.en_US.ISO-8859-1.xml 15 May 2007 20:14:24 -0000 1.4
+++ openacs-4/packages/chat-portlet/catalog/chat-portlet.en_US.ISO-8859-1.xml 7 Jun 2007 09:19:12 -0000 1.5
@@ -1,10 +1,19 @@
-
+
Add a chat room
+ Admin
Chat administration
+ Closed
+ Community
+ Community/Class
HTML mode
Manage chat
+ No Syndication Available
+ Not Private Room
+ Opened
Chat
+ Private Room
Rooms Administration
+ RSS
Index: openacs-4/packages/chat-portlet/catalog/chat-portlet.es_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/catalog/chat-portlet.es_ES.ISO-8859-1.xml,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat-portlet/catalog/chat-portlet.es_ES.ISO-8859-1.xml 15 May 2007 20:14:24 -0000 1.4
+++ openacs-4/packages/chat-portlet/catalog/chat-portlet.es_ES.ISO-8859-1.xml 7 Jun 2007 09:19:12 -0000 1.5
@@ -1,5 +1,5 @@
-
+
A�adir una sala
Administraci�n de chat
Index: openacs-4/packages/chat-portlet/catalog/chat-portlet.pt_BR.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/catalog/chat-portlet.pt_BR.ISO-8859-1.xml,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat-portlet/catalog/chat-portlet.pt_BR.ISO-8859-1.xml 15 May 2007 20:14:24 -0000 1.4
+++ openacs-4/packages/chat-portlet/catalog/chat-portlet.pt_BR.ISO-8859-1.xml 7 Jun 2007 09:19:12 -0000 1.5
@@ -1,5 +1,5 @@
-
+
Adicionar uma sala de chat
Administra��o do chat
Index: openacs-4/packages/chat-portlet/www/chat-admin-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/www/chat-admin-portlet.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/chat-portlet/www/chat-admin-portlet.adp 16 Dec 2006 19:39:21 -0000 1.4
+++ openacs-4/packages/chat-portlet/www/chat-admin-portlet.adp 7 Jun 2007 09:19:12 -0000 1.5
@@ -17,6 +17,6 @@
%>
Index: openacs-4/packages/chat-portlet/www/chat-portlet-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/www/chat-portlet-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/chat-portlet/www/chat-portlet-postgresql.xql 14 Mar 2006 12:23:38 -0000 1.1
+++ openacs-4/packages/chat-portlet/www/chat-portlet-postgresql.xql 7 Jun 2007 09:19:12 -0000 1.2
@@ -5,41 +5,89 @@
- select rm.room_id,
+ select distinct rm.room_id as room_id,
rm.pretty_name as pretty_name,
rm.description as description,
rm.moderated_p,
rm.active_p,
rm.archive_p,
+ rm.context_id,
+ 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)
from site_nodes
- where site_nodes.object_id = obj.context_id) as base_url
+ where site_nodes.object_id = obj.context_id) as base_url,
+ (select ru.alias
+ from chat_registered_users ru
+ where rm.room_id = ru.room_id
+ and ru.user_id = :user_id) as alias
from chat_rooms rm,
acs_objects obj
where rm.room_id = obj.object_id
- and obj.context_id IN ($sep_package_ids)
+ and obj.context_id IN ($sep_package_ids)
order by rm.pretty_name
- select rm.room_id,
- rm.pretty_name as pretty_name,
- rm.description as description,
+ select rm.room_id as room_id,
+ rm.context_id,
+ rm.pretty_name as pretty_name,
+ rm.description as description,
+ rm.moderated_p,
+ rm.active_p,
+ rm.archive_p,
+ rm.private as private,
+ rm.open as open,
+ 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,
+ (select ru.alias
+ from chat_registered_users ru
+ where rm.room_id = ru.room_id
+ and ru.user_id = :user_id) as alias
+ from chat_rooms rm,
+ acs_objects obj
+ where rm.room_id = obj.object_id
+ order by rm.context_id
+
+
+
+
+
+ select distinct rm.context_id
+ from chat_rooms rm,
+ acs_objects obj
+ where rm.room_id = obj.object_id
+ order by rm.context_id
+
+
+
+
+
+ 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
+ acs_objects obj,dotlrn_communities_all as dot
+ where rm.room_id = obj.object_id
order by rm.pretty_name
Index: openacs-4/packages/chat-portlet/www/chat-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/www/chat-portlet.adp,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/chat-portlet/www/chat-portlet.adp 15 May 2007 20:14:24 -0000 1.6
+++ openacs-4/packages/chat-portlet/www/chat-portlet.adp 7 Jun 2007 09:19:12 -0000 1.7
@@ -1,7 +1,6 @@
<%
#
- # Copyright (C) 2004 University of Valencia
- #
+ #
# This file is part of dotLRN.
#
# dotLRN is free software; you can redistribute it and/or modify it under the
@@ -20,33 +19,29 @@
#chat.Chat_main_page#
-[#chat.Create_a_new_room#]
+
+
+
+
+
+
+#chat.Search_a_room#
+
+
-
+
+
#chat.There_are_no_rooms_available#
Index: openacs-4/packages/chat-portlet/www/chat-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/www/chat-portlet.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/chat-portlet/www/chat-portlet.tcl 15 May 2007 20:14:24 -0000 1.3
+++ openacs-4/packages/chat-portlet/www/chat-portlet.tcl 7 Jun 2007 09:19:12 -0000 1.4
@@ -17,15 +17,14 @@
ad_page_contract {
The display logic for the chat portlet
- @author agustin (Agustin.Lopez@uv.es)
- @creation-date 2004-10-10
- @version $Id: chat-portlet.tcl,v 0.1 2004/10/10
+ @author agustin (Agustin.Lopez@uv.es) and Pablo Mu�oz (pablomp@tid.es)
} -properties {
context:onevalue
user_id:onevalue
room_create_p:onevalue
rooms:multirow
+ rooms3:multirow
}
array set config $cf
@@ -37,23 +36,363 @@
set user_id [ad_conn user_id]
set community_id [dotlrn_community::get_community_id]
set room_create_p [ad_permission_p $user_id chat_room_create]
+
set default_mode [ad_parameter DefaultClient chat "ajax"]
set num_rooms 0
+set path [ad_return_url]
+set package_id [ad_conn package_id]
+set room_create_p [permission::permission_p -object_id $package_id -privilege chat_room_create]
-if { $community_id eq 0 } {
- set query_name "rooms_list_all"
+set rss_exists [rss_support::subscription_exists \
+ -summary_context_id $package_id \
+ -impl_name chat_rss]
+
+set rss_feed_url [chat_util_get_url $package_id]chat/rss/rss.xml
+
+
+
+
+
+if { $community_id eq "" } {
+ set query_name "rooms_list_all"
+ set list 0
} else {
+ set list 1
set query_name "rooms_list"
}
-db_multirow -extend { can_see_p room_url html_room_url admin_url} rooms $query_name {} {
+
+
+db_multirow -extend { } rooms2 "rooms_list_all_comm" {} {
+}
+db_multirow -extend { active_users last_activity can_see_p rss_exists rss_feed_url2 rss_service admin_professor} rooms1 $query_name {} {
+ 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 can_see_p 0
+ 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]/chat/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
+ }
+
if {($active_p eq "t" && $user_p eq "t") || ($admin_p eq "t")} {
set can_see_p 1
set num_rooms [expr $num_rooms + 1]
- }
- set room_url [export_vars -base ${base_url}/room-enter {{client $default_mode} room_id}]
- set html_room_url [export_vars -base ${base_url}/room-enter {{client html} room_id}]
- set admin_url [export_vars -base ${base_url}/room {room_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"
+ }
+
}
+set active_users 0
+db_multirow -extend { active_users last_activity can_see_p rss_exists rss_feed_url2 rss_service admin_professor} rooms3 "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 /rss/rss.tcl?room_id=$room_id
+ set rss_service 0
+ 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
+ }
+ set can_see_p 0
+ if {($active_p eq "t" && $user_p eq "t") || ($admin_p eq "t")} {
+ set can_see_p 1
+ set num_rooms [expr $num_rooms + 1]
+ }
+ #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"
+ }
+
+}
+
+ db_foreach open "select end_date,room_id from chat_rooms" {
+ if { [clock format [clock seconds] -format "%Y/%m%d"] > $end_date } {
+ db_0or1row update_closed {
+ update chat_rooms SET open = 'false'
+ WHERE room_id = :room_id;
+ select 1;
+ }
+ } else {
+ db_0or1row update_closed {
+ update chat_rooms SET open = 'true'
+ WHERE room_id = :room_id;
+ select 1;
+ }
+ }
+
+
+ }
+
+
+
+list::create \
+ -name "rooms3" \
+ -multirow "rooms3" \
+ -key room_id \
+ -pass_properties {room_create_p} \
+ -row_pretty_plural [_ chat.room_options] \
+ -elements {
+ open {
+ label "#chat-portlet.open_room#"
+ html { style "text-align:center;" width 15px}
+ display_template {
+
+
+
+
+
+
+
+
+
+
+
+ }
+ }
+ private {
+ label "#chat-portlet.private_room#"
+ html { style "text-align:center;" width 15px}
+ display_template {
+
+
+
+
+
+
+
+
+
+
+
+ }
+ }
+
+ community {
+ label "#chat-portlet.community_class#"
+ html { style "text-align:center;" width 15px}
+ display_template {
+
+ @rooms3.community@
+
+ }
+ }
+ pretty_name {
+ label "#chat.Room_name#"
+ html { align "center"}
+ display_template {
+
+ @rooms3.pretty_name@
+
+
+ (NO #chat.Active#)
+
+ @rooms3.description@
+ }
+ }
+ active_users {
+ label "#chat.active_users#"
+ html { style "text-align:center;" }
+ }
+ last_activity {
+ label "#chat.last_activity#"
+ html { style "text-align:center;" width 15px}
+ }
+ rss {
+ label "#chat-portlet.rss#"
+ html { align "center" }
+ display_template {
+
+
+
+
#rss-support.Syndication_Feed#
+
+ #chat-portlet.no_rss#
+
+
+ #chat-portlet.no_rss#
+
+ }
+ }
+ admin {
+ label "#chat.actions#"
+ html { align "center" }
+ display_template {
+
+
+ \n#chat.room_admin#
+
+ \n#chat.Transcripts#
+
+
+ \n#chat.room_change_options#
+
+ \n#chat.Transcripts#
+
+
+
+ \n#chat.room_admin#
+
+ \n#chat.Transcripts#
+
+ }
+ }
+
+ }
+
+
+list::create \
+ -name "rooms1" \
+ -multirow "rooms1" \
+ -key room_id \
+ -pass_properties {room_create_p} \
+ -row_pretty_plural [_ chat.room_options] \
+ -elements {
+ open {
+ label "#chat-portlet.open_room#"
+ html { style "text-align:center;" width 15px}
+ display_template {
+
+
+
+
+
+
+
+
+
+
+
+ }
+ }
+ private {
+ label "#chat-portlet.private_room#"
+ html { style "text-align:center;" width 1px}
+ display_template {
+
+
+
+
+
+
+
+
+
+
+ }
+ }
+
+ community {
+ label "#chat-portlet.community#"
+ html { align "center"}
+ display_template {
+ @rooms1.community@
+ }
+ }
+ pretty_name {
+ label "#chat.Room_name#"
+ html { align "center"}
+ display_template {
+
+
+ @rooms1.pretty_name@
+
+
+ (NO #chat.Active#)
+
+ @rooms1.description@
+ }
+ }
+ active_users {
+ label "#chat.active_users#"
+ html { style "text-align:center;" }
+ }
+ last_activity {
+ label "#chat.last_activity#"
+ html { style "text-align:center;" }
+ }
+ rss {
+ label "#chat-portlet.rss#"
+ html { align "center" }
+ display_template {
+
+
+
+
#rss-support.Syndication_Feed#
+
+ #chat-portlet.no_rss#
+
+
+ #chat-portlet.no_rss#
+
+ }
+ }
+ admin {
+ label "#chat.actions#"
+ html { align "center" }
+ display_template {
+
+
+ \n#chat.room_admin#
+
+ \n#chat.Transcripts#
+
+
+ \n#chat.room_change_options#
+
+ \n#chat.Transcripts#
+
+
+
+ \n#chat.room_admin#
+
+ \n#chat.Transcripts#
+
+ }
+ }
+
+ }
+
ad_return_template
Index: openacs-4/packages/chat-portlet/www/rss.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/www/Attic/rss.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/chat-portlet/www/rss.tcl 7 Jun 2007 09:19:12 -0000 1.1
@@ -0,0 +1,42 @@
+
+ad_page_contract {
+
+ Setup or remove rss feed
+
+ @author Pablo Mu�oz(pablomp@tid.es)
+} {
+} -properties {
+} -validate {
+} -errors {
+}
+
+
+
+set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
+permission::require_permission \
+ -object_id $package_id \
+ -party_id $user_id \
+ -privilege "admin"
+
+if {[rss_support::subscription_exists \
+ -summary_context_id $package_id \
+ -impl_name news]} {
+ #deactivate rss
+ rss_support::del_subscription \
+ -summary_context_id $package_id \
+ -impl_name "chat_rss" \
+ -owner "chat"
+ set message "RSS feed deactivated"
+} else {
+ #activate rss
+ set subscr_id [rss_support::add_subscription \
+ -summary_context_id $package_id \
+ -impl_name "chat_rss" \
+ -lastbuild "now" \
+ -owner "chat"]
+ rss_gen_report $subscr_id
+ set message "RSS feed activated"
+}
+
+ad_returnredirect -message $message "./"
\ No newline at end of file