diff --git a/ChangeLog b/ChangeLog index 2c3b5eb61..08801c37d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2010-05-18 Wolfgang Sourdeau + * SoObjects/Appointments/iCalEvent+SOGo.m (-quickRecord): extract + the event category into the c_category column. + + * SoObjects/Appointments/iCalToDo+SOGo.m (-quickRecord): extract + the task category into the c_category column. + + * UI/Scheduler/UIxCalListingActions.m (+initialize): added the + new "c_category" field to the list of fields that require + fetching. + + * UI/WebServerResources/SchedulerUI.js: (newBaseEventDIV) shifted + field indexes by 1 from the 9th field, which is now the "category" + field. + * Main/SOGo.m (-dispatchRequest:): send a "SOGoRequestDuration" header back to the client with the time delta as value when SOGoDebugRequests is set to YES. diff --git a/OGoContentStore/appointment-oracle.ocs b/OGoContentStore/appointment-oracle.ocs index c4cc624ff..1c7f51655 100644 --- a/OGoContentStore/appointment-oracle.ocs +++ b/OGoContentStore/appointment-oracle.ocs @@ -95,6 +95,11 @@ sqlType = "VARCHAR2(255)"; allowsNull = YES; }, + { + columnName = c_category; + sqlType = "VARCHAR2(255)"; + allowsNull = YES; + }, { columnName = c_sequence; sqlType = "INTEGER"; diff --git a/OGoContentStore/appointment.ocs b/OGoContentStore/appointment.ocs index 95a79fdec..d13fedad4 100644 --- a/OGoContentStore/appointment.ocs +++ b/OGoContentStore/appointment.ocs @@ -95,6 +95,11 @@ sqlType = "VARCHAR(255)"; allowsNull = YES; }, + { + columnName = c_category; + sqlType = "VARCHAR(255)"; + allowsNull = YES; + }, { columnName = c_sequence; sqlType = "INT"; diff --git a/Scripts/sql-update-1.2.2_to_1.2.3.sh b/Scripts/sql-update-1.2.2_to_1.2.3.sh new file mode 100755 index 000000000..1058c2e0d --- /dev/null +++ b/Scripts/sql-update-1.2.2_to_1.2.3.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# this script only works with PostgreSQL + +defaultusername=$USER +defaulthostname=localhost +defaultdatabase=$USER +indextable=sogo_folder_info + +read -p "Username ($defaultusername): " username +read -p "Hostname ($defaulthostname): " hostname +read -p "Database ($defaultdatabase): " database + +if [ -z "$username" ] +then + username=$defaultusername +fi +if [ -z "$hostname" ] +then + hostname=$defaulthostname +fi +if [ -z "$database" ] +then + database=$defaultdatabase +fi + +sqlscript="" + +function addField() { + oldIFS="$IFS" + IFS=" " + part="`echo -e \"ALTER TABLE $table ADD COLUMN c_category VARCHAR(255);\\n\"`"; + sqlscript="$sqlscript$part" + IFS="$oldIFS" +} + +tables=`psql -t -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from $indextable where c_folder_type = 'Appointment';"` + +for table in $tables; +do + addField +done + +echo "$sqlscript" | psql -q -e -U $username -h $hostname $database > /dev/null diff --git a/SoObjects/Appointments/iCalEvent+SOGo.m b/SoObjects/Appointments/iCalEvent+SOGo.m index cc624d29a..29f691c15 100644 --- a/SoObjects/Appointments/iCalEvent+SOGo.m +++ b/SoObjects/Appointments/iCalEvent+SOGo.m @@ -64,7 +64,7 @@ NSMutableDictionary *row; NSCalendarDate *startDate, *endDate, *nextAlarmDate; NSArray *attendees; - NSString *uid, *title, *location, *status; + NSString *uid, *title, *location, *status, *category; NSNumber *sequence; id organizer; id participants, partmails; @@ -250,6 +250,9 @@ else [row setObject: [NSNumber numberWithInt: 0] forKey: @"c_nextalarm"]; + category = [self categories]; + if ([category length] > 0) + [row setObject: category forKey: @"c_category"]; return row; } diff --git a/SoObjects/Appointments/iCalToDo+SOGo.m b/SoObjects/Appointments/iCalToDo+SOGo.m index f54509b3e..00945c2fc 100644 --- a/SoObjects/Appointments/iCalToDo+SOGo.m +++ b/SoObjects/Appointments/iCalToDo+SOGo.m @@ -46,7 +46,7 @@ NSMutableDictionary *row; NSCalendarDate *startDate, *dueDate, *nextAlarmDate; NSArray *attendees; - NSString *uid, *title, *location, *status; + NSString *uid, *title, *location, *status, *category; NSNumber *sequence; id organizer, date; id participants, partmails; @@ -211,6 +211,10 @@ else [row setObject: [NSNumber numberWithInt: 0] forKey: @"c_nextalarm"]; + category = [self categories]; + if ([category length] > 0) + [row setObject: category forKey: @"c_category"]; + return row; } diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index c0f5c3337..55d120f11 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -82,17 +82,19 @@ static NSArray *tasksFields = nil; eventsFields = [NSArray arrayWithObjects: @"c_name", @"c_folder", @"c_status", @"c_title", @"c_startdate", @"c_enddate", @"c_location", @"c_isallday", - @"c_classification", @"c_partmails", - @"c_partstates", @"c_owner", @"c_iscycle", @"c_nextalarm", - @"c_recurrence_id", @"isException", @"editable", @"erasable", - @"ownerIsOrganizer", nil]; + @"c_classification", @"c_category", + @"c_partmails", @"c_partstates", @"c_owner", + @"c_iscycle", @"c_nextalarm", + @"c_recurrence_id", @"isException", @"editable", + @"erasable", @"ownerIsOrganizer", nil]; [eventsFields retain]; } if (!tasksFields) { tasksFields = [NSArray arrayWithObjects: @"c_name", @"c_folder", @"c_status", @"c_title", @"c_enddate", - @"c_classification", @"editable", @"erasable", @"c_priority", nil]; + @"c_classification", @"editable", @"erasable", + @"c_priority", nil]; [tasksFields retain]; } } diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 51380bcff..78c2f5c0f 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -352,7 +352,7 @@ function _deleteCalendarEventBlocks(calendar, cname, occurenceTime) { if (occurences) { for (var i = 0; i < occurences.length; i++) { var occurence = occurences[i]; - if (occurenceTime == null || occurenceTime == occurence[14]) { + if (occurenceTime == null || occurenceTime == occurence[15]) { var nodes = occurence.blocks; for (var j = 0; j < nodes.length; j++) { var node = nodes[j]; @@ -377,7 +377,7 @@ function _deleteEventFromTables(calendar, cname, occurenceTime) { var occurences = calendarEvents[calendar][cname]; if (occurences) { var occurence = occurences.first(); - var ownerIsOrganizer = occurence[18]; + var ownerIsOrganizer = occurence[19]; // Delete event from events list var table = $("eventsList"); @@ -396,7 +396,7 @@ function _deleteEventFromTables(calendar, cname, occurenceTime) { // This is the specified event or the same event in another // calendar. In this case, remove it only if the delete // operation is triggered from the organizer's calendar. - if (occurenceTime == null || occurenceTime == occurence[14]) { + if (occurenceTime == null || occurenceTime == occurence[15]) { row.parentNode.removeChild(row); break; } @@ -420,7 +420,7 @@ function _deleteCalendarEventCache(calendar, cname, occurenceTime) { if (calendarEvents[calendar]) { var occurences = calendarEvents[calendar][cname]; if (occurences) - ownerIsOrganizer = occurences[0][18]; + ownerIsOrganizer = occurences[0][19]; } for (var otherCalendar in calendarEvents) { @@ -437,8 +437,8 @@ function _deleteCalendarEventCache(calendar, cname, occurenceTime) { if (occurenceTime == null) { delete calendarEvents[otherCalendar][cname]; } - else if (occurenceTime != occurence[14]) { - // || occurenceTime == occurence[14]) { + else if (occurenceTime != occurence[15]) { + // || occurenceTime == occurence[15]) { newOccurences.push(occurence); } } @@ -767,7 +767,7 @@ function eventsListCallback(http) { var row = $(document.createElement("tr")); table.tBodies[0].appendChild(row); row.addClassName("eventRow"); - var rTime = data[i][14]; + var rTime = data[i][15]; var id = escape(data[i][1] + "-" + data[i][0]); if (rTime) id += "-" + escape(rTime); @@ -776,9 +776,9 @@ function eventsListCallback(http) { row.calendar = escape(data[i][1]); if (rTime) row.recurrenceTime = escape(rTime); - row.isException = data[i][15]; - row.editable = data[i][16]; - row.erasable = data[i][17]; + row.isException = data[i][16]; + row.editable = data[i][17]; + row.erasable = data[i][18]; var startDate = new Date(); startDate.setTime(data[i][4] * 1000); row.day = startDate.getDayString(); @@ -1243,28 +1243,29 @@ function newBaseEventDIV(eventRep, event, eventText) { // log ("6 location = " + event[6]); // log ("7 isallday = " + event[7]); // log ("8 classification = " + event[8]); - // log ("9 participants emails = " + event[9]); - // log ("10 participants states = " + event[10]); - // log ("11 owner = " + event[11]); - // log ("12 iscycle = " + event[12]); - // log ("13 nextalarm = " + event[13]); - // log ("14 recurrenceid = " + event[14]); - // log ("15 isexception = " + event[15]); - // log ("16 editable = " + event[16]); - // log ("17 erasable = " + event[17]); - // log ("18 ownerisorganizer = " + event[18]); + // log ("9 category = " + event[9]); + // log ("10 participants emails = " + event[10]); + // log ("11 participants states = " + event[11]); + // log ("12 owner = " + event[12]); + // log ("13 iscycle = " + event[13]); + // log ("14 nextalarm = " + event[14]); + // log ("15 recurrenceid = " + event[15]); + // log ("16 isexception = " + event[16]); + // log ("17 editable = " + event[17]); + // log ("18 erasable = " + event[18]); + // log ("19 ownerisorganizer = " + event[19]); var eventCell = $(document.createElement("div")); eventCell.cname = event[0]; eventCell.calendar = event[1]; if (eventRep.recurrenceTime) eventCell.recurrenceTime = eventRep.recurrenceTime; - eventCell.isException = event[15]; - eventCell.editable = event[16]; - eventCell.erasable = event[17]; - eventCell.ownerIsOrganizer = event[18]; + eventCell.isException = event[16]; + eventCell.editable = event[17]; + eventCell.erasable = event[18]; + eventCell.ownerIsOrganizer = event[19]; eventCell.addClassName("event"); - if (event[13] > 0) + if (event[14] > 0) eventCell.addClassName("alarm"); var innerDiv = $(document.createElement("div")); @@ -1763,7 +1764,7 @@ function _eventBlocksMatching(calendar, cname, recurrenceTime) { if (recurrenceTime) { for (var i = 0; i < occurences.length; i++) { var occurence = occurences[i]; - if (occurence[14] == recurrenceTime) + if (occurence[15] == recurrenceTime) blocks = occurence.blocks; } }