]> err.no Git - scalable-opengroupware.org/commitdiff
"Copy from Anais" functionality
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 14 Sep 2004 15:12:10 +0000 (15:12 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 14 Sep 2004 15:12:10 +0000 (15:12 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@306 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/Anais/AnaisSelector.m
SOGo/UI/Anais/AnaisUidSelector.m
SOGo/UI/Anais/ChangeLog
SOGo/UI/Anais/Version
SOGo/UI/Contacts/ChangeLog
SOGo/UI/Contacts/English.lproj/default.strings
SOGo/UI/Contacts/French.lproj/default.strings
SOGo/UI/Contacts/UIxContactEditor.m
SOGo/UI/Contacts/UIxContactEditor.wox
SOGo/UI/Contacts/UIxContactsSelectionView.m
SOGo/UI/Contacts/Version

index 8b1b34e5e39341b3c95c0ef6c6fb6dc156d18edc..f8ce7d0f26173dbe28aa35181ba1950b32dcfdb6 100644 (file)
 
 #include <SOGoUI/UIxComponent.h>
 
+/*
+ AnaisSelector
+ Open a satellite window providing access to Anais.
+ Bindings:
+ title           - button title to display to user
+ windowId        - string to be used for uniquing this window to a particular
+                   purpose (i.e. for adding participants)
+ division        - Anais division
+ callback        - name of JavaScript callback function to use in caller's page
+ extraAttributes - extra attributes to add as paramaters to the callback
+ Sample:
+ <var:component className="AnaisSelector"
+                const:windowId="ParticipantSelection"
+                const:division="CC"
+                const:callback="addParticipant"
+                const:extraAttributes="givenName,initials"
+ />
+ */
+
 @interface AnaisSelector : UIxComponent
 {
     NSString *title;
     NSString *windowId;
     NSString *division;
     NSString *callback;
+    NSString *extraAttributes;
 }
 
 - (void)setTitle:(NSString *)_title;
 }
 
 - (void)dealloc {
-  [self->title    release];
-  [self->windowId release];
-  [self->division release];
-  [self->callback release];
+  [self->title           release];
+  [self->windowId        release];
+  [self->division        release];
+  [self->callback        release];
+  [self->extraAttributes release];
   [super dealloc];
 }
 
   return self->callback;
 }
 
+- (void)setExtraAttributes:(NSString *)_extraAttributes {
+  ASSIGN(self->extraAttributes, _extraAttributes);
+}
+- (NSString *)extraAttributes {
+  return self->extraAttributes;
+}
+
 /* JavaScript */
 
 - (NSString *)jsFunctionName {
 - (NSString *)jsCode {
   static NSString *codeFmt = \
     @"function %@() {\n"
-    @"  var url = '/anais/aideAnais.php?m_fonc=%@%@&m_champ=mail,uid,sn#mon_etiquette';\n"
+    @"  var url = '/anais/aideAnais.php?m_fonc=%@%@&m_champ=mail,uid,sn%@#mon_etiquette';\n"
     @"  var anaisWindow = window.open(url, '%@', 'width=350, height=600, left=10, top=10, toolbar=no, dependent=yes, menubar=no, location=no, resizable=yes, scrollbars=yes, directories=no, status=no');\n"
     @"  anaisWindow.focus();\n"
     @"}";
-    static NSString *divFmt = @"&m_type=%@";
-    NSString *fmt;
-
-    if([self division])
-        fmt = [NSString stringWithFormat:divFmt, [self division]];
-    else
-        fmt = @"";
+  static NSString *divFmt = @"&m_type=%@";
+  NSString *fmt, *exAttrFmt;
+  
+  if([self division])
+    fmt = [NSString stringWithFormat:divFmt, [self division]];
+  else
+    fmt = @"";
+  
+  if([self extraAttributes])
+    exAttrFmt = [NSString stringWithFormat:@",%@", [self extraAttributes]];
+  else
+    exAttrFmt = @"";
 
     return [NSString stringWithFormat:codeFmt,
-        [self jsFunctionName],
-        [self callback],
-        fmt,
-        [self windowId]];
+      [self jsFunctionName],
+      [self callback],
+      fmt,
+      exAttrFmt,
+      [self windowId]];
 }
 
 @end /* AnaisSelector */
index 9515b59dbe3b686d460112cb21c34fe82ed10ed8..3d500a0c56d81039b28836ee88399f0332fb8459 100644 (file)
 
 #include <SOGoUI/UIxComponent.h>
 
+/*
+ AnaisUidSelector
+ Modifiable list of uids used to select multiple calendars for viewing at once.
+*/
+
 @interface AnaisUidSelector : UIxComponent
 {
     NSArray *calendarUIDs;
index b27155aef51181785c6918c4b84cfa8a60242394..e76280bca0a8ec52cb44bd8c329b638d606654a3 100644 (file)
@@ -1,3 +1,13 @@
+2004-09-14  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.14
+       
+       * AnaisUidSelector.m: added tiny bit of documentation
+       
+       * AnaisSelector.m: provide API documentation and added code to set
+         extra arguments for Anais, so that callback can receive arbitrary
+         values
+
 2004-09-13  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v0.9.13
index 3228956b23187929b415362e1bf6c6811a6faebb..84882450d03e5de20f6a2fc6d388201ee846a91d 100644 (file)
@@ -1,3 +1,3 @@
 # $Id: Version 165 2004-08-05 17:55:50Z znek $
 
-SUBMINOR_VERSION:=13
+SUBMINOR_VERSION:=14
index c2f66d90453b4aeec1d5dd1649e8e1328c3491b2..799578926f6b50779fe6689649fdb294c8a686b8 100644 (file)
@@ -1,5 +1,13 @@
 2004-09-14  Marcus Mueller  <znek@mulle-kybernetik.com>
 
+       * v0.9.12
+
+       * UIxContactEditor.[wox|m]: Copy from Anais functionality
+
+       * UIxContactsSelectionView.m: minor cleanup
+
+       * {English.lproj,French.lproj}/defaults.plist: new localizable string
+
        * v0.9.11
 
        * UIxContactSelector.m: changed width of satellite window to 800px
index a7ef693ed7add1bbe600bd5d1430de0e3dc30fff..3ff39b6c93e0778396fb784962ae76c739feef3c 100644 (file)
@@ -28,3 +28,4 @@
 "delete"            = "delete";
 "Save"              = "Save";
 "Cancel"            = "Cancel";
+"Copy from Anais"   = "Copy from Anaïs";
index a7ef693ed7add1bbe600bd5d1430de0e3dc30fff..7f982ba041a5fe9960ab3009c25bc133de7056ea 100644 (file)
@@ -28,3 +28,4 @@
 "delete"            = "delete";
 "Save"              = "Save";
 "Cancel"            = "Cancel";
+"Add from Anais"    = "Add from Anaïs";
index d065a590b791f74d67c86666c038088a5f830d48..9c3f724cd9088b876e837f7e0df1386d2c44f211 100644 (file)
   [_record addEntriesFromDictionary:[self snapshot]];
 }
 
+/* JavaScript */
+
+- (NSString *)jsCopyContactCode {
+  static NSString *jsCode = \
+    @"function copyContact(type, cn, dn, email, uid, sn, "
+    @"givenName, telephoneNumber, facsimileTelephoneNumber, "
+    @"postalAddress, homePostalAddress"
+    @") {\n"
+    @"  var e;\n"
+    @"  e = document.getElementById('email');\n"
+    @"  e.setAttribute('value', email);\n"
+    @"  e = document.getElementById('sn');\n"
+    @"  e.setAttribute('value', sn);\n"
+    @"  e = document.getElementById('givenName');\n"
+    @"  e.setAttribute('value', 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('postalAddress');\n"
+    @"  e.setAttribute('value', postalAddress);\n"
+    @"  e = document.getElementById('homePostalAddress');\n"
+    @"  e.setAttribute('value', homePostalAddress);\n"
+    @"}\n";
+  return jsCode;
+}
+
 /* helper */
 
 - (NSString *)_completeURIForMethod:(NSString *)_method {
index f4a795bd9f090247569ba3420717e8e4aff0490b..1b0cc996aa1a46b1fd50a12ba3260e6b5a1dec5b 100644 (file)
     }
   </style>
 
+  <script language="JavaScript">
+    <var:string value="jsCopyContactCode" const:escapeHTML="NO" />
+  </script>
+
   <form var:href="clientObject.baseURL">
     <table cellspacing="0" cellpadding="5" width="100%">
       <tr>
         <td>
           <table border="0" cellpadding="2" cellspacing="0" class="editsec">
             <tr>
+              <td align="right" colspan="2">
+                <var:component className="AnaisSelector"
+                               const:windowId="UIxContactTemplates"
+                               label:title="Copy from Anais"
+                               const:callback="copyContact"
+                               const:extraAttributes="givenName,telephoneNumber,facsimileTelephoneNumber,postalAddress,homePostalAddress"
+                />
+              </td>
+            </tr><tr>
               <td align="left" colspan="2">
                 <span class="aptview_title">
                   <var:string label:value="Common" />
               </td>
               <td align="left" bgcolor="#FFFFF0">
                 <span class="aptview_text">
-                  <input type="text" name="sn" var:value="snapshot.sn" 
-                         size="60" />
+                  <input type="text"
+                         name="sn"
+                         id="sn"
+                         var:value="snapshot.sn"
+                         size="60"
+                  />
                 </span>
               </td>
             </tr>
               </td>
               <td align="left" bgcolor="#FFFFF0">
                 <span class="aptview_text">
-                  <input type="text" name="givenName"
-                         var:value="snapshot.givenName" 
-                         size="60" />
+                  <input type="text"
+                         name="givenName"
+                         id="givenName"
+                         var:value="snapshot.givenName"
+                         size="60"
+                  />
                 </span>
               </td>
             </tr>
               </td>
               <td align="left" bgcolor="#FFFFF0">
                 <span class="aptview_text">
-                  <input type="text" name="telephoneNumber" 
-                         var:value="snapshot.telephoneNumber" 
-                         size="60" />
+                  <input type="text"
+                         name="telephoneNumber"
+                         id="telephoneNumber"
+                         var:value="snapshot.telephoneNumber"
+                         size="60"
+                  />
                 </span>
               </td>
             </tr>
               </td>
               <td align="left" bgcolor="#FFFFF0">
                 <span class="aptview_text">
-                  <input type="text" name="facsimileTelephoneNumber" 
-                         var:value="snapshot.facsimileTelephoneNumber" 
-                         size="60" />
+                  <input type="text"
+                         name="facsimileTelephoneNumber"
+                         id="facsimileTelephoneNumber"
+                         var:value="snapshot.facsimileTelephoneNumber"
+                         size="60"
+                  />
                 </span>
               </td>
             </tr>
               </td>
               <td align="left" bgcolor="#FFFFF0">
                 <span class="aptview_text">
-                  <textarea name="postalAddress" rows="3" cols="60" 
+                  <textarea name="postalAddress"
+                            id="postalAddress"
+                            rows="3"
+                            cols="60"
                             wrap="physical"
-                            var:value="snapshot.postalAddress" />
+                            var:value="snapshot.postalAddress"
+                  />
                 </span>
               </td>
             </tr>
               </td>
               <td align="left" bgcolor="#FFFFF0">
                 <span class="aptview_text">
-                  <textarea name="homePostalAddress" rows="3" cols="60" 
+                  <textarea name="homePostalAddress"
+                            rows="3"
+                            cols="60"
                             wrap="physical"
-                            var:value="snapshot.homePostalAddress" />
+                            var:value="snapshot.homePostalAddress"
+                  />
                 </span>
               </td>
             </tr>
               </td>
               <td align="left" bgcolor="#FFFFF0">
                 <span class="aptview_text">
-                  <input type="text" name="mail" 
-                         var:value="snapshot.mail" 
-                         size="60" />
+                  <input type="text"
+                         name="mail"
+                         id="email"
+                         var:value="snapshot.mail"
+                         size="60"
+                  />
                 </span>
               </td>
             </tr>
index 6525bf416be56512909311b74a1e17655a47c489..47cc4cc9e20472ae5e9855c0b5db75b11340ff8b 100644 (file)
@@ -48,8 +48,8 @@
 }
 
 - (NSString *)jsOnClickCode {
-  static NSString *jsCode = @"javascript:opener.window.%@" \
-                            @"('', '%@', '', '%@', '', '');";
+  static NSString *jsCode = \
+    @"javascript:opener.window.%@('', '%@', '', '%@', '', '');";
   NSString *cn;
   
   cn = [NSString stringWithFormat:@"%@ %@",
index c351558f441a4d159527ee99c46d76a467ff4349..9cef79939ea704d51f0e6725b9964991d0cafe31 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=11
+SUBMINOR_VERSION:=12