From aff879bf209e818ab6d13264971cd637e8c2e666 Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 19 Jul 2005 15:51:16 +0000 Subject: [PATCH] moved JavaScript used in contact editor to a .js file git-svn-id: http://svn.opengroupware.org/SOGo/trunk@829 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/OGoContentStore/README | 4 -- SOGo/UI/Contacts/ChangeLog | 5 ++ SOGo/UI/Contacts/UIxContactEditorBase.m | 54 ---------------- SOGo/UI/Contacts/Version | 2 +- .../Templates/ContactsUI/UIxContactEditor.wox | 16 +---- .../UI/WebServerResources/UIxContactEditor.js | 61 +++++++++++++++++++ 6 files changed, 70 insertions(+), 72 deletions(-) create mode 100644 SOGo/UI/WebServerResources/UIxContactEditor.js diff --git a/SOGo/OGoContentStore/README b/SOGo/OGoContentStore/README index b2d35c76..4c2b1d3b 100644 --- a/SOGo/OGoContentStore/README +++ b/SOGo/OGoContentStore/README @@ -97,10 +97,6 @@ Update: we now have OCSiCalFieldExtractor extractor = [self->folderInfo quickExtractor]; quickRow = [extractor extractQuickFieldsFromContent:_content]; -- vCard - - we don't have a vCard parser yet - - except the one by Max, we could use it - Support Tools ============= diff --git a/SOGo/UI/Contacts/ChangeLog b/SOGo/UI/Contacts/ChangeLog index 554d45fd..0bd02047 100644 --- a/SOGo/UI/Contacts/ChangeLog +++ b/SOGo/UI/Contacts/ChangeLog @@ -1,3 +1,8 @@ +2005-07-19 Helge Hess + + * UIxContactEditorBase.m: moved copyContact JS code to + UIxContactEditor.js file (v0.9.26) + 2005-07-18 Helge Hess * English.lproj/Localizable.strings: added text for invalid emails diff --git a/SOGo/UI/Contacts/UIxContactEditorBase.m b/SOGo/UI/Contacts/UIxContactEditorBase.m index e2ec3a00..53cf78dd 100644 --- a/SOGo/UI/Contacts/UIxContactEditorBase.m +++ b/SOGo/UI/Contacts/UIxContactEditorBase.m @@ -143,60 +143,6 @@ [_record addEntriesFromDictionary:[self snapshot]]; } -/* JavaScript */ - -- (NSString *)jsCopyContactCode { - static NSString *jsCode = \ - @"function unescapeCallbackParameter(s) {\n" - @" if(!s || s.length == 0)\n" - @" return s;\n" - @" s = s.replace(/'/g, \"'\");\n" - @" s = s.replace(/"/g, '\"');\n" - @" return s;\n" - @"}\n" - @"\n" - @"function copyContact(type, email, uid, sn," - @"cn, givenName, telephoneNumber, facsimileTelephoneNumber, mobile, postalAddress, homePostalAddress, departmentNumber, l)" - @"{\n" - // @" var type = arguments[0]; \n" - // @" var email = arguments[1]; \n" - // @" var uid = arguments[2]; \n" - // @" var sn = arguments[3]; \n" - // @" var givenName = arguments[4]; \n" - // @" var telephoneNumber = arguments[5]; \n" - // @" var facsimileTelephoneNumber = arguments[6]; \n" - // @" var mobile = arguments[7]; \n" - // @" var postalAddress = arguments[8]; \n" - // @" var homePostalAddress = arguments[9]; \n" - // @" var departmentNumber = arguments[10]; \n" - // @" var l = arguments[11]; \n" - @" var e;\n" - @" e = document.getElementById('cn');\n" - @" e.setAttribute('value', unescapeCallbackParameter(cn));\n" - @" e = document.getElementById('email');\n" - @" e.setAttribute('value', email);\n" - @" e = document.getElementById('sn');\n" - @" e.setAttribute('value', unescapeCallbackParameter(sn));\n" - @" e = document.getElementById('givenName');\n" - @" e.setAttribute('value', unescapeCallbackParameter(givenName));\n" - @" e = document.getElementById('telephoneNumber');\n" - @" e.setAttribute('value', telephoneNumber);\n" - @" e = document.getElementById('facsimileTelephoneNumber');\n" - @" e.setAttribute('value', facsimileTelephoneNumber);\n" - @" e = document.getElementById('mobile');\n" - @" e.setAttribute('value', mobile);\n" - @" e = document.getElementById('postalAddress');\n" - @" e.setAttribute('value', unescapeCallbackParameter(postalAddress));\n" - @" e = document.getElementById('homePostalAddress');\n" - @" e.setAttribute('value', unescapeCallbackParameter(homePostalAddress));\n" - @" e = document.getElementById('departmentNumber');\n" - @" e.setAttribute('value', unescapeCallbackParameter(departmentNumber));\n" - @" e = document.getElementById('l');\n" - @" e.setAttribute('value', unescapeCallbackParameter(l));\n" - @"}\n"; - return jsCode; -} - /* helper */ - (NSString *)_completeURIForMethod:(NSString *)_method { diff --git a/SOGo/UI/Contacts/Version b/SOGo/UI/Contacts/Version index 931bb074..9b850ab3 100644 --- a/SOGo/UI/Contacts/Version +++ b/SOGo/UI/Contacts/Version @@ -1,6 +1,6 @@ # GNUstep makefile -SUBMINOR_VERSION:=25 +SUBMINOR_VERSION:=26 # v0.9.18 requires NGExtensions v4.5.136 # v0.9.16 requires libSOGoUI v0.9.16 diff --git a/SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox b/SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox index 9ac83421..441bff33 100644 --- a/SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox +++ b/SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox @@ -8,25 +8,15 @@ className="UIxPageFrame" title="name" > + + - -
diff --git a/SOGo/UI/WebServerResources/UIxContactEditor.js b/SOGo/UI/WebServerResources/UIxContactEditor.js new file mode 100644 index 00000000..bfc1adeb --- /dev/null +++ b/SOGo/UI/WebServerResources/UIxContactEditor.js @@ -0,0 +1,61 @@ +function unescapeCallbackParameter(s) { + if(!s || s.length == 0) + return s; + s = s.replace(/'/g, "'"); + s = s.replace(/"/g, '"'); + return s; +} + +function copyContact(type, email, uid, sn, + cn, givenName, telephoneNumber, facsimileTelephoneNumber, + mobile, postalAddress, homePostalAddress, + departmentNumber, l) +{ + // var type = arguments[0]; + // var email = arguments[1]; + // var uid = arguments[2]; + // var sn = arguments[3]; + // var givenName = arguments[4]; + // var telephoneNumber = arguments[5]; + // var facsimileTelephoneNumber = arguments[6]; + // var mobile = arguments[7]; + // var postalAddress = arguments[8]; + // var homePostalAddress = arguments[9]; + // var departmentNumber = arguments[10]; + // var l = arguments[11]; + var e; + e = document.getElementById('cn'); + e.setAttribute('value', unescapeCallbackParameter(cn)); + e = document.getElementById('email'); + e.setAttribute('value', email); + e = document.getElementById('sn'); + e.setAttribute('value', unescapeCallbackParameter(sn)); + e = document.getElementById('givenName'); + e.setAttribute('value', unescapeCallbackParameter(givenName)); + e = document.getElementById('telephoneNumber'); + e.setAttribute('value', telephoneNumber); + e = document.getElementById('facsimileTelephoneNumber'); + e.setAttribute('value', facsimileTelephoneNumber); + e = document.getElementById('mobile'); + e.setAttribute('value', mobile); + e = document.getElementById('postalAddress'); + e.setAttribute('value', unescapeCallbackParameter(postalAddress)); + e = document.getElementById('homePostalAddress'); + e.setAttribute('value', unescapeCallbackParameter(homePostalAddress)); + e = document.getElementById('departmentNumber'); + e.setAttribute('value', unescapeCallbackParameter(departmentNumber)); + e = document.getElementById('l'); + e.setAttribute('value', unescapeCallbackParameter(l)); +}; + +function validateContactEditor() { + var e; + + e = document.getElementById('email'); + if (e.value.length == 0) + return true; + if (uixEmailRegex.test(e.value) != true) + return confirm(labels.invalidemailwarn); + + return true; +} -- 2.39.5