diff --git a/ChangeLog b/ChangeLog index be8c221b4..7b8e390df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-10-26 Wolfgang Sourdeau + * OGoContentStore/OCSContactFieldExtractor.m + (-extractQuickFieldsFromVCard:): we now extract the list of + categories from the vcard. + * UI/WebServerResources/UIxPreferences.js: added code to handle the new "Contacts Options" tab, in particular the contacts categories. diff --git a/OGoContentStore/GNUmakefile.preamble b/OGoContentStore/GNUmakefile.preamble index e39140e3f..0d0184bdd 100644 --- a/OGoContentStore/GNUmakefile.preamble +++ b/OGoContentStore/GNUmakefile.preamble @@ -6,11 +6,12 @@ libOGoContentStore_LIBRARIES_DEPEND_UPON += \ -lNGCards \ -lNGExtensions \ -lEOControl \ - -lSaxObjC + -lSaxObjC \ + -lSOGo ADDITIONAL_INCLUDE_DIRS += -I. -I.. -I../SOPE -ADDITIONAL_LIB_DIRS += -L./$(GNUSTEP_OBJ_DIR) -L../SOPE/NGCards/$(GNUSTEP_OBJ_DIR)/ +ADDITIONAL_LIB_DIRS += -L./$(GNUSTEP_OBJ_DIR) -L../SOPE/NGCards/$(GNUSTEP_OBJ_DIR)/ -L../SoObjects/SOGo/SOGo.framework/ SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib diff --git a/OGoContentStore/OCSContactFieldExtractor.m b/OGoContentStore/OCSContactFieldExtractor.m index 8327971f8..60e204182 100644 --- a/OGoContentStore/OCSContactFieldExtractor.m +++ b/OGoContentStore/OCSContactFieldExtractor.m @@ -28,6 +28,8 @@ #import #import +#import + @interface OCSContactFieldExtractor : GCSFieldExtractor @end @@ -78,6 +80,10 @@ [fields setObject: [adr value: 3] forKey: @"c_l"]; value = [[vCard uniqueChildWithTag: @"X-AIM"] value: 0]; [fields setObject: value forKey: @"c_screenname"]; + values = [[vCard categories] trimmedComponents]; + if ([values count] > 0) + [fields setObject: [values componentsJoinedByString: @","] + forKey: @"c_categories"]; [fields setObject: @"vcard" forKey: @"c_component"]; return fields; diff --git a/OGoContentStore/contact-oracle.ocs b/OGoContentStore/contact-oracle.ocs index b01621b2a..9ab1e9034 100644 --- a/OGoContentStore/contact-oracle.ocs +++ b/OGoContentStore/contact-oracle.ocs @@ -55,6 +55,11 @@ sqlType = "VARCHAR2(255)"; allowsNull = YES; }, + { + columnName = c_categories; + sqlType = "VARCHAR2(255)"; + allowsNull = YES; + }, { columnName = c_component; sqlType = "VARCHAR2(10)"; diff --git a/OGoContentStore/contact.ocs b/OGoContentStore/contact.ocs index 84984796d..a2f1af5e9 100644 --- a/OGoContentStore/contact.ocs +++ b/OGoContentStore/contact.ocs @@ -55,6 +55,11 @@ sqlType = "VARCHAR(255)"; allowsNull = YES; }, + { + columnName = c_categories; + sqlType = "VARCHAR(255)"; + allowsNull = YES; + }, { columnName = c_component; sqlType = "VARCHAR(10)"; diff --git a/Scripts/sql-update-1.3.3_to_1.3.4-mysql.sh b/Scripts/sql-update-1.3.3_to_1.3.4-mysql.sh new file mode 100644 index 000000000..df4ec854e --- /dev/null +++ b/Scripts/sql-update-1.3.3_to_1.3.4-mysql.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# this script only works with MySQL + +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_categories VARCHAR(255);\\n\"`"; + sqlscript="$sqlscript$part" + IFS="$oldIFS" +} + +tables=`mysql -p -N -B -u $username -h $hostname $database -e "select SUBSTRING_INDEX(c_quick_location, '/', -1) from $indextable where c_folder_type = 'Contact';"` + +for table in $tables; +do + addField +done +echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database > /dev/null diff --git a/Scripts/sql-update-1.3.3_to_1.3.4.sh b/Scripts/sql-update-1.3.3_to_1.3.4.sh new file mode 100644 index 000000000..ee3c570bb --- /dev/null +++ b/Scripts/sql-update-1.3.3_to_1.3.4.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_categories 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 = 'Contact';"` + +for table in $tables; +do + addField +done + +echo "$sqlscript" | psql -q -e -U $username -h $hostname $database > /dev/null