Index: openacs-4/packages/calendar/calendar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/calendar.info,v diff -u -r1.45 -r1.46 --- openacs-4/packages/calendar/calendar.info 22 Apr 2018 18:02:52 -0000 1.45 +++ openacs-4/packages/calendar/calendar.info 30 Apr 2018 13:54:38 -0000 1.46 @@ -7,7 +7,7 @@ f f - + Dirk Gomez Personal and shared event calendars. 2017-08-06 @@ -17,10 +17,10 @@ 2 #calendar.Calendar# - + - + Index: openacs-4/packages/calendar/catalog/calendar.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/catalog/calendar.en_US.ISO-8859-1.xml,v diff -u -r1.35 -r1.36 --- openacs-4/packages/calendar/catalog/calendar.en_US.ISO-8859-1.xml 9 Mar 2012 20:39:38 -0000 1.35 +++ openacs-4/packages/calendar/catalog/calendar.en_US.ISO-8859-1.xml 30 Apr 2018 13:54:38 -0000 1.36 @@ -92,6 +92,7 @@ Item last week List + Location Are you sure you want to delete this calendar. All the calendar items and all the permission that's associated with this calendar will be deleted as well. @@ -207,8 +208,10 @@ Tuesday Type: Type - Your calendar item can optionally be classified into types. Choose one from the drop down. + Your calendar item can optionally be classified + into types. Choose one from the drop down. Use Hours Below: + Use Hours Below: View Wednesday Week Index: openacs-4/packages/calendar/sql/oracle/cal-item-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/oracle/cal-item-create.sql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/calendar/sql/oracle/cal-item-create.sql 22 Apr 2018 18:02:52 -0000 1.13 +++ openacs-4/packages/calendar/sql/oracle/cal-item-create.sql 30 Apr 2018 13:54:38 -0000 1.14 @@ -110,8 +110,8 @@ ------------------------------------------------------------- -- create package cal_item ------------------------------------------------------------- - - + + create or replace package cal_item as function new ( @@ -129,7 +129,12 @@ context_id in acs_objects.context_id%TYPE default null, creation_date in acs_objects.creation_date%TYPE default sysdate, creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null + creation_ip in acs_objects.creation_ip%TYPE default null, + package_id in acs_objects.package_id%TYPE default null, + location in acs_event.location%TYPE default null, + related_link_url in acs_event.related_link_url%TYPE default null, + related_link_text in acs_event.related_link_text%TYPE default null, + redirect_to_rel_link_p in acs_event.redirect_to_rel_link_p%TYPE default null ) return cal_items.cal_item_id%TYPE; -- delete cal_item @@ -166,7 +171,10 @@ creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null, package_id in acs_objects.package_id%TYPE default null, - location in acs_event.location%TYPE default null + location in acs_event.location%TYPE default null, + related_link_url in acs_event.related_link_url%TYPE default null, + related_link_text in acs_event.related_link_text%TYPE default null, + redirect_to_rel_link_p in acs_event.redirect_to_rel_link_p%TYPE default null ) return cal_items.cal_item_id%TYPE is @@ -190,7 +198,10 @@ creation_ip => creation_ip, context_id => context_id, package_id => package_id, - location => location + location => location, + related_link_url => related_link_url, + related_link_text => related_link_text, + redirect_to_rel_link_p => redirect_to_rel_link_p ); insert into cal_items Index: openacs-4/packages/calendar/sql/oracle/upgrade/upgrade-2.10.0d1-2.10.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/oracle/upgrade/upgrade-2.10.0d1-2.10.0d2.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/calendar/sql/oracle/upgrade/upgrade-2.10.0d1-2.10.0d2.sql 22 Apr 2018 18:02:52 -0000 1.1 +++ openacs-4/packages/calendar/sql/oracle/upgrade/upgrade-2.10.0d1-2.10.0d2.sql 30 Apr 2018 13:54:38 -0000 1.2 @@ -1,4 +1,38 @@ +create or replace package cal_item +as + function new ( + cal_item_id in cal_items.cal_item_id%TYPE default null, + on_which_calendar in calendars.calendar_id%TYPE , + name in acs_activities.name%TYPE default null, + description in acs_activities.description%TYPE default null, + html_p in acs_activities.html_p%TYPE default 'f', + status_summary in acs_activities.status_summary%TYPE default null, + timespan_id in acs_events.timespan_id%TYPE default null, + activity_id in acs_events.activity_id%TYPE default null, + recurrence_id in acs_events.recurrence_id%TYPE default null, + item_type_id in cal_items.item_type_id%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'cal_item', + context_id in acs_objects.context_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + package_id in acs_objects.package_id%TYPE default null, + location in acs_event.location%TYPE default null + ) return cal_items.cal_item_id%TYPE; + + -- delete cal_item + procedure del ( + cal_item_id in cal_items.cal_item_id%TYPE + ); + procedure delete_all ( + recurrence_id in acs_events.recurrence_id%TYPE + ); + +end cal_item; +/ +show errors; + create or replace package body cal_item as function new ( Index: openacs-4/packages/calendar/sql/oracle/upgrade/upgrade-2.10.0d3-2.10.0d4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/oracle/upgrade/upgrade-2.10.0d3-2.10.0d4.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/sql/oracle/upgrade/upgrade-2.10.0d3-2.10.0d4.sql 30 Apr 2018 13:54:38 -0000 1.1 @@ -0,0 +1,174 @@ +create or replace package cal_item +as + function new ( + cal_item_id in cal_items.cal_item_id%TYPE default null, + on_which_calendar in calendars.calendar_id%TYPE , + name in acs_activities.name%TYPE default null, + description in acs_activities.description%TYPE default null, + html_p in acs_activities.html_p%TYPE default 'f', + status_summary in acs_activities.status_summary%TYPE default null, + timespan_id in acs_events.timespan_id%TYPE default null, + activity_id in acs_events.activity_id%TYPE default null, + recurrence_id in acs_events.recurrence_id%TYPE default null, + item_type_id in cal_items.item_type_id%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'cal_item', + context_id in acs_objects.context_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + package_id in acs_objects.package_id%TYPE default null, + location in acs_event.location%TYPE default null, + related_link_url in acs_event.related_link_url%TYPE default null, + related_link_text in acs_event.related_link_text%TYPE default null, + redirect_to_rel_link_p in acs_event.redirect_to_rel_link_p%TYPE default null + ) return cal_items.cal_item_id%TYPE; + + -- delete cal_item + procedure del ( + cal_item_id in cal_items.cal_item_id%TYPE + ); + + procedure delete_all ( + recurrence_id in acs_events.recurrence_id%TYPE + ); + +end cal_item; +/ +show errors; + + + +create or replace package body cal_item +as + function new ( + cal_item_id in cal_items.cal_item_id%TYPE default null, + on_which_calendar in calendars.calendar_id%TYPE , + name in acs_activities.name%TYPE default null, + description in acs_activities.description%TYPE default null, + html_p in acs_activities.html_p%TYPE default 'f', + status_summary in acs_activities.status_summary%TYPE default null, + timespan_id in acs_events.timespan_id%TYPE default null, + activity_id in acs_events.activity_id%TYPE default null, + recurrence_id in acs_events.recurrence_id%TYPE default null, + item_type_id in cal_items.item_type_id%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'cal_item', + context_id in acs_objects.context_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + package_id in acs_objects.package_id%TYPE default null, + location in acs_event.location%TYPE default null, + related_link_url in acs_event.related_link_url%TYPE default null, + related_link_text in acs_event.related_link_text%TYPE default null, + redirect_to_rel_link_p in acs_event.redirect_to_rel_link_p%TYPE default null + ) return cal_items.cal_item_id%TYPE + + is + v_cal_item_id cal_items.cal_item_id%TYPE; + v_grantee_id acs_permissions.grantee_id%TYPE; + v_privilege acs_permissions.privilege%TYPE; + + begin + v_cal_item_id := acs_event.new ( + event_id => cal_item_id, + name => name, + description => description, + html_p => html_p, + status_summary => status_summary, + timespan_id => timespan_id, + activity_id => activity_id, + recurrence_id => recurrence_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id, + package_id => package_id, + location => location, + related_link_url => related_link_url, + related_link_text => related_link_text, + redirect_to_rel_link_p => redirect_to_rel_link_p + ); + + insert into cal_items + (cal_item_id, on_which_calendar, item_type_id) + values (v_cal_item_id, on_which_calendar, item_type_id); + + -- assign the default permission to the cal_item + -- by default, cal_item are going to inherit the + -- calendar permission that it belongs too. + + -- first find out the permissions. + --select grantee_id into v_grantee_id + --from acs_permissions + --where object_id = cal_item.new.on_which_calendar; + + --select privilege into v_privilege + --from acs_permissions + --where object_id = cal_item.new.on_which_calendar; + + -- now we grant the permissions + --acs_permission.grant_permission ( + -- object_id => v_cal_item_id, + -- grantee_id => v_grantee_id, + -- privilege => v_privilege + + --); + + return v_cal_item_id; + + end new; + + procedure del ( + cal_item_id in cal_items.cal_item_id%TYPE + ) + is + v_activity_id acs_events.activity_id%TYPE; + v_recurrence_id acs_events.recurrence_id%TYPE; + begin + + select activity_id, recurrence_id into v_activity_id, v_recurrence_id + from acs_events + where event_id = cal_item_id; + + -- Erase the cal_item associated with the id + delete from cal_items + where cal_item_id = cal_item.del.cal_item_id; + + -- Erase all the privileges + delete from acs_permissions + where object_id = cal_item.del.cal_item_id; + + acs_event.del(cal_item_id); + + IF instances_exist_p(recurrence_id) = 'f' THEN + -- + -- There are no more events for the activity, we can clean up + -- both, the activity and - if given - the recurrence. + -- + acs_activity.del(v_activity_id); + + IF v_recurrence_id is not null THEN + recurrence.del(v_recurrence_id); + END IF; + END IF; + + end del; + + procedure delete_all ( + recurrence_id in acs_events.recurrence_id%TYPE + ) is + v_event_id acs_events%ROWTYPE; + begin + FOR v_event_id in + (select * from acs_events + where recurrence_id = delete_all.recurrence_id) + LOOP + cal_item.del(v_event_id.event_id); + end LOOP; + + recurrence.del(recurrence_id); + end delete_all; +end cal_item; +/ +show errors Index: openacs-4/packages/calendar/sql/postgresql/cal-item-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/postgresql/cal-item-create.sql,v diff -u -r1.18 -r1.19 --- openacs-4/packages/calendar/sql/postgresql/cal-item-create.sql 22 Apr 2018 18:02:52 -0000 1.18 +++ openacs-4/packages/calendar/sql/postgresql/cal-item-create.sql 30 Apr 2018 13:54:38 -0000 1.19 @@ -159,7 +159,11 @@ new__creation_user integer, -- acs_objects.creation_date%TYPE default null new__creation_ip varchar, -- default null new__package_id integer, -- default null - new__location varchar default null + new__location varchar default NULL, + new__related_link_url varchar default NULL, + new__related_link_text varchar default NULL, + new__redirect_to_rel_link_p boolean default NULL + ) returns integer AS $$ declare v_cal_item_id cal_items.cal_item_id%TYPE; @@ -179,7 +183,10 @@ new__creation_ip, -- creation_ip new__context_id, -- context_id new__package_id, -- package_id - new__location -- location + new__location, -- location + new__related_link_url, + new__related_link_text, + new__redirect_to_rel_link_p ); insert into cal_items (cal_item_id, on_which_calendar) Index: openacs-4/packages/calendar/sql/postgresql/upgrade/upgrade-2.10.0d3-2.10.0d4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/postgresql/upgrade/upgrade-2.10.0d3-2.10.0d4.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/sql/postgresql/upgrade/upgrade-2.10.0d3-2.10.0d4.sql 30 Apr 2018 13:54:38 -0000 1.1 @@ -0,0 +1,56 @@ +DROP function if exists +cal_item__new(integer, integer, character varying, character varying, boolean, character varying, integer, integer, integer, character varying, integer, timestamp with time zone, integer, character varying, integer, character varying); + +select define_function_args('acs_event__new','event_id;null,name;null,description;null,html_p;null,status_summary;null,timespan_id;null,activity_id;null,recurrence_id;null,object_type;acs_event,creation_date;now(),creation_user;null,creation_ip;null,context_id;null,package_id;null,location;null,related_link_url;null,related_link_text;null,redirect_to_rel_link_p;null'); + +CREATE OR REPLACE FUNCTION acs_event__new( + new__event_id integer, -- default null, + new__name varchar, -- default null, + new__description text, -- default null, + new__html_p boolean, -- default null + new__status_summary text, -- default null + new__timespan_id integer, -- default null, + new__activity_id integer, -- default null, + new__recurrence_id integer, -- default null, + new__object_type varchar, -- default 'acs_event', + new__creation_date timestamptz, -- default now(), + new__creation_user integer, -- default null, + new__creation_ip varchar, -- default null, + new__context_id integer, -- default null + new__package_id integer, -- default null + new__location varchar default NULL, + new__related_link_url varchar default NULL, + new__related_link_text varchar default NULL, + new__redirect_to_rel_link_p boolean default NULL + +) RETURNS integer AS $$ + -- acs_events.event_id%TYPE +DECLARE + v_event_id acs_events.event_id%TYPE; +BEGIN + v_event_id := acs_object__new( + new__event_id, -- object_id + new__object_type, -- object_type + new__creation_date, -- creation_date + new__creation_user, -- creation_user + new__creation_ip, -- creation_ip + new__context_id, -- context_id + 't', -- security_inherit_p + new__name, -- title + new__package_id -- package_id + ); + + insert into acs_events + (event_id, name, description, html_p, status_summary, + activity_id, timespan_id, recurrence_id, location, + related_link_url, related_link_text, redirect_to_rel_link_p) + values + (v_event_id, new__name, new__description, new__html_p, new__status_summary, + new__activity_id, new__timespan_id, new__recurrence_id, new__location, + new__related_link_url, new__related_link_text, new__redirect_to_rel_link_p); + + return v_event_id; + +END; +$$ LANGUAGE plpgsql; + Index: openacs-4/packages/calendar/tcl/cal-item-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs-oracle.xql,v diff -u -r1.16 -r1.17 --- openacs-4/packages/calendar/tcl/cal-item-procs-oracle.xql 22 Apr 2018 18:02:52 -0000 1.16 +++ openacs-4/packages/calendar/tcl/cal-item-procs-oracle.xql 30 Apr 2018 13:54:38 -0000 1.17 @@ -54,16 +54,19 @@ begin :1 := cal_item.new( - on_which_calendar => :calendar_id, - name => :name, - activity_id => :activity_id, - timespan_id => :timespan_id, - item_type_id => :item_type_id, - creation_user => :creation_user, - creation_ip => :creation_ip, - context_id => :calendar_id, - package_id => :package_id, - location => :location + on_which_calendar => :calendar_id, + name => :name, + activity_id => :activity_id, + timespan_id => :timespan_id, + item_type_id => :item_type_id, + creation_user => :creation_user, + creation_ip => :creation_ip, + context_id => :calendar_id, + package_id => :package_id, + location => :location, + related_link_url => :related_link_url, + related_link_text => :related_link_text, + redirect_to_rel_link_p => :redirect_to_rel_link_p ); end; Index: openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql,v diff -u -r1.24 -r1.25 --- openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql 22 Apr 2018 18:02:52 -0000 1.24 +++ openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql 30 Apr 2018 13:54:38 -0000 1.25 @@ -67,7 +67,10 @@ :creation_user, :creation_ip, :package_id, - :location + :location, + :related_link_url, + :related_link_text, + :redirect_to_rel_link_p ) Index: openacs-4/packages/calendar/tcl/cal-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs.tcl,v diff -u -r1.31 -r1.32 --- openacs-4/packages/calendar/tcl/cal-item-procs.tcl 25 Apr 2018 19:47:46 -0000 1.31 +++ openacs-4/packages/calendar/tcl/cal-item-procs.tcl 30 Apr 2018 13:54:38 -0000 1.32 @@ -33,6 +33,9 @@ {-item_type_id ""} {-package_id ""} {-location ""} + {-related_link_url ""} + {-related_link_text ""} + {-redirect_to_rel_link_p ""} {-cal_uid ""} {-ical_vars ""} } { @@ -97,6 +100,19 @@ } } +ad_proc -private calendar::item::all_day_event {start_date_ansi end_date_ansi} { + + Determine, if an event is an all day event depending on the ans + state and and dates (e.g. "2018-03-22 00:00:00" and "2018-03-23 + 00:00:00". The event is a full_day event, either when the + start_date is equal to the end data or the start_day is different + to the end day (this might happen through external calendars). + +} { + return [expr {$start_date_ansi eq $end_date_ansi + || [lindex $start_date_ansi 0] ne [lindex $end_date_ansi 0]}] +} + ad_proc -public calendar::item::get { {-cal_item_id:required} {-array} @@ -126,13 +142,16 @@ set row(start_date_ansi) [lc_time_system_to_conn $row(start_date_ansi)] set row(end_date_ansi) [lc_time_system_to_conn $row(end_date_ansi)] } - - if { $row(start_date_ansi) eq $row(end_date_ansi) } { + # + # all day events: either the start date + # + if { [all_day_event $row(start_date_ansi) $row(end_date_ansi)] } { set row(time_p) 0 } else { set row(time_p) 1 } - + ns_log notice "calendar::item::get $row(start_date_ansi) eq $row(end_date_ansi) => $row(time_p)" + # Localize set row(start_time) [lc_time_fmt $row(start_date_ansi) "%X"] @@ -185,6 +204,9 @@ {-edit_past_events_p 1} {-calendar_id ""} {-location ""} + {-related_link_url ""} + {-related_link_text ""} + {-redirect_to_rel_link_p ""} {-cal_uid ""} {-ical_vars ""} } { Index: openacs-4/packages/calendar/tcl/cal-item-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/calendar/tcl/cal-item-procs.xql 22 Apr 2018 18:02:52 -0000 1.10 +++ openacs-4/packages/calendar/tcl/cal-item-procs.xql 30 Apr 2018 13:54:38 -0000 1.11 @@ -38,7 +38,10 @@ e.related_link_url, e.related_link_text, e.redirect_to_rel_link_p, - e.location + e.location, + e.related_link_url, + e.related_link_text, + e.redirect_to_rel_link_p from acs_events e join timespans s on (e.timespan_id = s.timespan_id) @@ -78,7 +81,10 @@ e.related_link_url, e.related_link_text, e.redirect_to_rel_link_p, - e.location + e.location, + e.related_link_url, + e.related_link_text, + e.redirect_to_rel_link_p from acs_events e join timespans s on (e.timespan_id = s.timespan_id) @@ -197,7 +203,10 @@ update acs_events set name = :name, description = :description, - location = :location + location = :location, + related_link_url = :related_link_url, + related_link_text = :related_link_text, + redirect_to_rel_link_p = :redirect_to_rel_link_p where event_id = :cal_item_id Index: openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl 2 Apr 2018 07:08:06 -0000 1.5 +++ openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl 30 Apr 2018 13:54:38 -0000 1.6 @@ -186,7 +186,7 @@ aa_true "activity_id ($activity_id) is gone" {$activity_id eq ""} # - # Create now a a recurring calendar item + # Create now a recurring calendar item # aa_log "create a recurreinig calendar item" Index: openacs-4/packages/calendar/www/cal-item-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-new.tcl,v diff -u -r1.40 -r1.41 --- openacs-4/packages/calendar/www/cal-item-new.tcl 7 Aug 2017 23:48:05 -0000 1.40 +++ openacs-4/packages/calendar/www/cal-item-new.tcl 30 Apr 2018 13:54:38 -0000 1.41 @@ -1,5 +1,5 @@ ad_page_contract { - + Creating a new Calendar Item @author Dirk Gomez (openacs@dirkgomez.de) @@ -40,7 +40,7 @@ if { ![ad_form_new_p -key cal_item_id] } { set calendar_id [db_string get_calendar_id { select on_which_calendar as calendar_id - from cal_items + from cal_items where cal_item_id = :cal_item_id } -default ""] } else { @@ -60,17 +60,17 @@ {title:text(text) {label "[_ calendar.Title_1]"} - {html {size 45} maxlength 255} + {html {size 45 maxlength 255}} } {date:date {label "[_ calendar.Date_1]"} {format "YYYY MM DD"} {after_html { \[[_ calendar.y-m-d]\]} } } - {time_p:text(radio) + {time_p:text(radio) {label " "} {options {{"[_ calendar.All_Day_Event]" 0} - {"[_ calendar.Use_Hours_Below]" 1} }} + {"[_ calendar.Use_Hours_Below]" 1} }} } {start_time:date,optional @@ -82,11 +82,24 @@ {label "[_ calendar.End_Time]"} {format {[lc_get formbuilder_time_format]}} } + {location:text(text),optional + {label "[_ calendar.Location]"} + {html {size 44 maxlength 255}} + } {description:text(textarea),optional {label "[_ calendar.Description]"} {html {cols 45 rows 10}} } + {related_link_url:text(text),optional + {label "[_ calendar.RelatedLink]"} + {html {size 45 maxlength 255}} + } + {related_link_text:text(hidden),optional + } + {redirect_to_rel_link_p:text(hidden),optional + } + {calendar_id:integer(radio) {label "[_ calendar.Sharing]"} {options $calendar_options} @@ -95,23 +108,23 @@ template::add_body_script -script { function TimePChanged(elm) { - var form_name = "cal_item"; + var form_name = "cal_item"; - if (elm == null) return; - if (document.forms == null) return; - if (document.forms[form_name] == null) return; - if (elm.value == 0) { - disableTime(form_name); - } else { - enableTime(form_name); - } + if (elm == null) return; + if (document.forms == null) return; + if (document.forms[form_name] == null) return; + if (elm.value == 0) { + disableTime(form_name); + } else { + enableTime(form_name); + } } } if { [ad_form_new_p -key cal_item_id] } { ad_form -extend -name cal_item -form { - {repeat_p:text(radio) + {repeat_p:text(radio) {label "[_ calendar.Repeat_1]"} {options {{"[_ calendar.Yes]" 1} {"[_ calendar.No]" 0} }} @@ -121,8 +134,8 @@ ad_form -extend -name cal_item -form { {edit_what:text(radio) {label "[_ calendar.Apply_Changes_to]"} - {options {{"[_ calendar.This_Event]" this} - {"[_ calendar.All_Past_and_Future_Events]" all} + {options {{"[_ calendar.This_Event]" this} + {"[_ calendar.All_Past_and_Future_Events]" all} {"[_ calendar.This_and_All_Future_Events]" future}}} } } @@ -140,10 +153,10 @@ while { $format_string ne "" } { # Snip off the next token regexp {([^/\-.: ]*)([/\-.: ]*)(.*)} \ - $format_string match word sep format_string + $format_string match word sep format_string # Extract the trailing "t", if any regexp -nocase $template::util::date::token_exp $word \ - match token type + match token type # Output the widget set fragment_def $template::util::date::fragment_widgets([string toupper $token]) @@ -171,7 +184,7 @@ } -ad_form -extend -name cal_item -validate { +ad_form -extend -name cal_item -validate { {title {[string length $title] <= 4000} "Title is too long" } @@ -181,54 +194,58 @@ } -new_request { # Seamlessly create a private calendar if the user doesn't have one if { ![calendar::have_private_p -party_id $user_id] } { - set calendar_id [calendar::new \ - -owner_id $user_id \ - -private_p "t" \ - -calendar_name "Personal" \ - -package_id $package_id] - } - + set calendar_id [calendar::new \ + -owner_id $user_id \ + -private_p "t" \ + -calendar_name "Personal" \ + -package_id $package_id] + } + set date [calendar::from_sql_datetime -sql_date $ansi_date -format "YYY-MM-DD"] set repeat_p 0 if {[info exists start_time] && $start_time ne "" && $start_time != 0} { - # Set the start time - set start_hour $start_time - set start_time "{} {} {} $start_time 0 {} {HH24:MI}" - set end_time "{} {} {} [expr {$start_hour + 1}] 0 {} {HH24:MI}" - set time_p 1 + # Set the start time + set start_hour $start_time + set start_time "{} {} {} $start_time 0 {} {HH24:MI}" + set end_time "{} {} {} [expr {$start_hour + 1}] 0 {} {HH24:MI}" + set time_p 1 } else { - set time_p 0 - set start_hour $start_time - set start_time "{} {} {} 0 0 {} {HH24:MI}" - set end_time "{} {} {} 0 0 {} {HH24:MI}" + set time_p 0 + set start_hour $start_time + set start_time "{} {} {} 0 0 {} {HH24:MI}" + set end_time "{} {} {} 0 0 {} {HH24:MI}" set js "disableTime('cal_item');" } # set the calendar_id before setting item_types form element (see top of script) DAVEB set calendar_id [lindex $calendar_options 0 1] + } -edit_request { calendar::item::get -cal_item_id $cal_item_id -array cal_item - permission::require_write_permission -object_id $cal_item_id -creation_user $cal_item(creation_user) - set cal_item_id $cal_item(cal_item_id) - set n_attachments $cal_item(n_attachments) - set ansi_start_date $cal_item(start_date_ansi) - set ansi_end_date $cal_item(end_date_ansi) - set start_time $cal_item(start_time) - set end_time $cal_item(end_time) - set title $cal_item(name) - set description $cal_item(description) - set repeat_p $cal_item(recurrence_id) - set item_type $cal_item(item_type) - set item_type_id $cal_item(item_type_id) - set calendar_id $cal_item(calendar_id) - set time_p $cal_item(time_p) + set cal_item_id $cal_item(cal_item_id) + set n_attachments $cal_item(n_attachments) + set ansi_start_date $cal_item(start_date_ansi) + set ansi_end_date $cal_item(end_date_ansi) + set start_time $cal_item(start_time) + set end_time $cal_item(end_time) + set title $cal_item(name) + set description $cal_item(description) + set location $cal_item(location) + set related_link_url $cal_item(related_link_url) + set related_link_text $cal_item(related_link_text) + set redirect_to_rel_link_p $cal_item(redirect_to_rel_link_p) + set repeat_p $cal_item(recurrence_id) + set item_type $cal_item(item_type) + set item_type_id $cal_item(item_type_id) + set calendar_id $cal_item(calendar_id) + set time_p $cal_item(time_p) if { $time_p == 0 } { - set js "disableTime('cal_item');" + set js "disableTime('cal_item');" } else { - set js "enableTime('cal_item');" + set js "enableTime('cal_item');" } if { $repeat_p eq "" } { set repeat_p 0 @@ -244,26 +261,21 @@ element set_properties cal_item edit_what -widget hidden element set_value cal_item edit_what 0 } - # To support green calendar - # set date [template::util::date::from_ansi $ansi_start_date] - # set date [lindex $ansi_start_date 0] - set date [calendar::from_sql_datetime -sql_date $ansi_start_date -format "YYY-MM-DD"] + set date [calendar::from_sql_datetime -sql_date $ansi_start_date -format "YYY-MM-DD"] set start_time [template::util::date::from_ansi $ansi_start_date [lc_get formbuilder_time_format]] - set end_time [template::util::date::from_ansi $ansi_end_date [lc_get formbuilder_time_format]] + set end_time [template::util::date::from_ansi $ansi_end_date [lc_get formbuilder_time_format]] + } -new_data { - # To support green calendar - # set date [split $date "-"] - # lappend date "" - # lappend date "" - # lappend date "" - # lappend date "YYYY MM DD" - # set date [calendar::to_sql_datetime -date $date -time ""] + set formatted_date "" + append formatted_date \ + [template::util::date::get_property year $date] " " \ + [template::util::date::get_property month $date] " " \ + [template::util::date::get_property day $date] + set date $formatted_date - set date "[template::util::date::get_property year $date] [template::util::date::get_property month $date] [template::util::date::get_property day $date]" - set start_date [calendar::to_sql_datetime -date $date -time $start_time -time_p $time_p] - set end_date [calendar::to_sql_datetime -date $date -time $end_time -time_p $time_p] + set end_date [calendar::to_sql_datetime -date $date -time $end_time -time_p $time_p] if { ![calendar::personal_p -calendar_id $calendar_id] } { permission::require_permission -object_id $calendar_id -privilege create @@ -273,29 +285,35 @@ -end_date $end_date \ -name $title \ -description $description \ + -location $location \ + -related_link_url $related_link_url \ + -related_link_text $related_link_text \ + -redirect_to_rel_link_p $redirect_to_rel_link_p \ -calendar_id $calendar_id \ -item_type_id $item_type_id] if {$repeat_p} { ad_returnredirect [export_vars -base cal-item-create-recurrence { return_url cal_item_id}] } else { if {$return_url ne "./" } { - ad_returnredirect $return_url - } else { - ad_returnredirect [export_vars -base cal-item-view { cal_item_id }] - } - } + ad_returnredirect $return_url + } else { + ad_returnredirect [export_vars -base cal-item-view { cal_item_id }] + } + } ad_script_abort } -edit_data { - #set date [split $date "-"] - #lappend date "" - #lappend date "" - #lappend date "" - #lappend date "YYYY MM DD" - # set date [calendar::to_sql_datetime -date $date -time ""] - set date "[template::util::date::get_property year $date] [template::util::date::get_property month $date] [template::util::date::get_property day $date]" + # + # Format date + # + set formatted_date "" + append formatted_date \ + [template::util::date::get_property year $date] " " \ + [template::util::date::get_property month $date] " " \ + [template::util::date::get_property day $date] + set date $formatted_date # Require write permission on the item and create on the calendar into which we're putting it permission::require_write_permission -object_id $cal_item_id @@ -331,19 +349,24 @@ -end_date $end_date \ -name $title \ -description $description \ + -location $location \ + -related_link_url $related_link_url \ + -related_link_text $related_link_text \ + -redirect_to_rel_link_p $redirect_to_rel_link_p \ -item_type_id $item_type_id \ -edit_all_p $edit_all_p \ -edit_past_events_p $edit_past_events_p \ -calendar_id $calendar_id if {$return_url ne "./" } { - ad_returnredirect $return_url + ad_returnredirect $return_url } else { - ad_returnredirect [export_vars -base cal-item-view { cal_item_id }] + ad_returnredirect [export_vars -base cal-item-view { cal_item_id }] } ad_script_abort - + } -on_request { + template::add_event_listener -id cal_item:elements:time_p:0 -script {TimePChanged(this);} template::add_event_listener -id cal_item:elements:time_p:1 -script {TimePChanged(this);} template::add_event_listener -id cal_item.date-button -script {showCalendarWithDateWidget('date', 'y-m-d');} @@ -360,7 +383,6 @@ - # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/calendar/www/cal-item-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-view.adp,v diff -u -r1.41 -r1.42 --- openacs-4/packages/calendar/www/cal-item-view.adp 7 Aug 2017 23:48:05 -0000 1.41 +++ openacs-4/packages/calendar/www/cal-item-view.adp 30 Apr 2018 13:54:38 -0000 1.42 @@ -21,7 +21,7 @@
@cal_item.name@ -
+
@@ -40,7 +40,11 @@
@@ -63,6 +67,15 @@ + +
+
#calendar.Location#:
+
+ @cal_item.location@ +
+
+
+
Index: openacs-4/packages/calendar/www/cal-item-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-view.tcl,v diff -u -r1.26 -r1.27 --- openacs-4/packages/calendar/www/cal-item-view.tcl 7 Aug 2017 23:48:05 -0000 1.26 +++ openacs-4/packages/calendar/www/cal-item-view.tcl 30 Apr 2018 13:54:38 -0000 1.27 @@ -1,6 +1,6 @@ ad_page_contract { View one event - + @author Ben Adida (ben@openforce.net) @creation-date April 09, 2002 @cvs-id $Id$ @@ -28,7 +28,9 @@ # Attachments? if {$cal_item(n_attachments) > 0} { - set item_attachments [attachments::get_attachments -object_id $cal_item(cal_item_id) -return_url [ad_return_url]] + set item_attachments [attachments::get_attachments \ + -object_id $cal_item(cal_item_id) \ + -return_url [ad_return_url]] } else { set item_attachments [list] } @@ -38,9 +40,13 @@ # Attachment URLs if {[calendar::attachments_enabled_p]} { - set attachment_options "add attachment" -} else { - set attachment_options {} + set href [attachments::add_attachment_url \ + -object_id $cal_item(cal_item_id) \ + -pretty_name $cal_item(name) \ + -return_url "../cal-item-view?cal_item_id=$cal_item(cal_item_id)"] + set attachment_options "#attachments.Add_Attachment#" +} else { + set attachment_options {} } set date $cal_item(start_date) @@ -56,7 +62,7 @@ template::head::add_css -href "/resources/calendar/calendar.css" -media all template::head::add_css -alternate -href "/resources/calendar/calendar-hc.css" -title "highContrast" -ad_return_template +ad_return_template # Local variables: