]> err.no Git - scalable-opengroupware.org/commitdiff
moved JavaScript used in contact editor to a .js file
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 19 Jul 2005 15:51:16 +0000 (15:51 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 19 Jul 2005 15:51:16 +0000 (15:51 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@829 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/OGoContentStore/README
SOGo/UI/Contacts/ChangeLog
SOGo/UI/Contacts/UIxContactEditorBase.m
SOGo/UI/Contacts/Version
SOGo/UI/Templates/ContactsUI/UIxContactEditor.wox
SOGo/UI/WebServerResources/UIxContactEditor.js [new file with mode: 0644]

index b2d35c76119569288313cb6c2589f4c9d04ca254..4c2b1d3b6afd3d3bfb2cf94fbd13e5ed4f62baad 100644 (file)
@@ -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
 =============
 
index 554d45fde50a712362f2deb425c8559ede157796..0bd02047523d4f82ced3fba477cdaabc9d683d6f 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-19  Helge Hess  <helge.hess@opengroupware.org>
+
+       * UIxContactEditorBase.m: moved copyContact JS code to
+         UIxContactEditor.js file (v0.9.26)
+
 2005-07-18  Helge Hess  <helge.hess@opengroupware.org>
 
        * English.lproj/Localizable.strings: added text for invalid emails
index e2ec3a00249dfaf6562df4163a6fb70af1b14030..53cf78ddc375fac6212cb64510bb70bdf5cf22fd 100644 (file)
   [_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(/&apos;/g, \"'\");\n"
-    @"  s = s.replace(/&quot;/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 {
index 931bb0747560e143e40e9a7445fd084fa6875be8..9b850ab3150faaa15c01c73b771513ed3de7bb92 100644 (file)
@@ -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
index 9ac83421d521432dcc51b5652b22c8573ac6291d..441bff338b5cd17919c0d5df72ba00fea09fcb7b 100644 (file)
@@ -8,25 +8,15 @@
   className="UIxPageFrame"
   title="name"
 >
+  <var:js-stringtable const:framework="ContactsUI.SOGo"
+                      const:identifier="labels" />
+  
   <style>
     table.editsec {
       background-color: #e8e8e0;
       width:            100%;
     }
   </style>
-
-  <script language="JavaScript">
-    <var:string value="jsCopyContactCode" const:escapeHTML="NO" />
-    
-    function validateContactEditor() {
-      var e = document.getElementById('email');
-      if (e.value.length == 0)
-        return true;
-      if (uixEmailRegex.test(e.value) != true)
-        return confirm('<var:string label:value="invalidemailwarn"/>');
-      return true;
-    }
-  </script>
   
   <form var:href="clientObject.baseURL" name="editform"
         onsubmit="return validateContactEditor()">
diff --git a/SOGo/UI/WebServerResources/UIxContactEditor.js b/SOGo/UI/WebServerResources/UIxContactEditor.js
new file mode 100644 (file)
index 0000000..bfc1ade
--- /dev/null
@@ -0,0 +1,61 @@
+function unescapeCallbackParameter(s) {
+  if(!s || s.length == 0)
+    return s;
+  s = s.replace(/&apos;/g, "'");
+  s = s.replace(/&quot;/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;
+}