[Bedework-commit] carddav r169 - in trunk/clients/javascript/bwAddrbookClient: . config resources

svnadmin at bedework.org svnadmin at bedework.org
Sat Oct 23 00:24:46 EDT 2010


Author: johnsa
Date: 2010-10-23 00:24:46 -0400 (Sat, 23 Oct 2010)
New Revision: 169

Added:
   trunk/clients/javascript/bwAddrbookClient/config/configExtended.js
Modified:
   trunk/clients/javascript/bwAddrbookClient/config/config.js
   trunk/clients/javascript/bwAddrbookClient/index.html
   trunk/clients/javascript/bwAddrbookClient/resources/addressbook.js
Log:
javascript client: strip html from exposed text; highlight input fields on focus

Modified: trunk/clients/javascript/bwAddrbookClient/config/config.js
===================================================================
--- trunk/clients/javascript/bwAddrbookClient/config/config.js	2010-10-22 22:13:25 UTC (rev 168)
+++ trunk/clients/javascript/bwAddrbookClient/config/config.js	2010-10-23 04:24:46 UTC (rev 169)
@@ -85,63 +85,6 @@
        "vcards" : [
            
        ] 
-   },
-   {
-       "label" : "public people",
-       "carddavUrl" : "/ucarddav",
-       "path" : "/public",
-       "bookName" : "/people/",
-       "type" : "subscription",
-       "listDisp" : {
-         "name" : false,
-         "familyName" : true,
-         "givenNames" : true,
-         "phone" : true,
-         "email" : true,
-         "title" : true,
-         "org" : true,
-         "url" : true
-       },
-       "detailDisp" : {
-         "phone" : true,
-         "email" : true,
-         "title" : true,
-         "org" : true,
-         "url" : true
-       },
-       "vcards" : [
-             
-       ] 
-   },
-   {
-       "label" : "public locations",
-       "carddavUrl" : "/ucarddav",
-       "path" : "/public",
-       "bookName" : "/locations/",
-       "type" : "subscription",
-       "listDisp" : {
-         "name" : true,
-         "familyName" : false,
-         "givenNames" : false,
-         "phone" : true,
-         "email" : false,
-         "title" : false,
-         "org" : false,
-         "url" : true
-       },
-       "detailDisp" : {
-         "name" : true,
-         "familyName" : false,
-         "givenNames" : false,
-         "phone" : true,
-         "email" : true,
-         "title" : true,
-         "org" : true,
-         "url" : true
-       },
-       "vcards" : [
-             
-       ] 
    }
    
  ];

Added: trunk/clients/javascript/bwAddrbookClient/config/configExtended.js
===================================================================
--- trunk/clients/javascript/bwAddrbookClient/config/configExtended.js	                        (rev 0)
+++ trunk/clients/javascript/bwAddrbookClient/config/configExtended.js	2010-10-23 04:24:46 UTC (rev 169)
@@ -0,0 +1,182 @@
+/* 
+    Licensed to Jasig under one or more contributor license
+    agreements. See the NOTICE file distributed with this work
+    for additional information regarding copyright ownership.
+    Jasig licenses this file to you under the Apache License,
+    Version 2.0 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a
+    copy of the License at:
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on
+    an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied. See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+
+/** Bedework Address Book extended configuration settings
+ *
+ * @author Arlen Johnson       johnsa - rpi.edu
+ * 
+ * This config file demonstrates how to include subscriptions
+ * to other carddav accounts in the client.
+ * This example includes a subscription to two public 
+ * accounts that are part of Bedework 3.7.  Such subscriptions are 
+ * probably not practical in a production environment as they'd 
+ * likely be too large.
+ * 
+ * To use this config, 
+ * 1. change the reference to config.js to configExtended.js in the 
+ *    index.html file
+ * 2. uncomment the subscriptions menu div in index.html
+ * 
+ */
+
+/* Define address books for inclusion in the client.
+ * We will assume for now that there is only one writable
+ * personal address book.  It is indicated by setting
+ * "type".  We will likewise assume for now that all 
+ * subscribed books are read-only.
+ * 
+ * Note that when vcard subscriptions are supported, they will 
+ * appear dynamically.  This listing allows us to specify
+ * the user carddav path and any other public paths we
+ * want present for all users.
+ * 
+ * label:         String - the display title for the book
+ * carddavUrl:    String - root of the carddav server; may be a full
+ *                         URL and may include first part of the path
+ *                         information (e.g. the context, as we do) 
+ * path:          String - more path information
+ * bookName:      String - last part of the path information.  If we
+ *                         are using a personal book the userid will
+ *                         be placed between the path and bookname.
+ * type:          String - takes the following values:
+ *                         personal-default  - the default personal book: there may be only one
+ *                         personal          - another personal book
+ *                         subscription      - a subscribed address book
+ *                                             For the present this client assumes books 
+ *                                             that are not personal are read-only.      
+ * listDisp       Object - list of fields to display (or not) in the address book list
+ * detailDisp     Object - list of fields to display (or not) in a contact's detail view                                                               
+ * vcards:        Array  - an empty array; this will be filled with
+ *                         vcard objects when the client connects to 
+ *                         the server on page load.
+ */
+var bwBooks = [
+   {
+       "label" : "personal",
+       "carddavUrl" : "/ucarddav",
+       "path" : "/user/",
+       "bookName" : "/addressbook/",
+       "type" : "personal-default",
+       "listDisp" : {
+          "name" : false,
+          "familyName" : true,
+          "givenNames" : true,
+          "phone" : true,
+          "phone" : true,
+          "email" : true,
+          "title" : true,
+          "org" : true,
+          "url" : true
+       },
+       "detailDisp" : {
+          "name" : false,
+          "familyName" : true,
+          "givenNames" : true,
+          "phone" : true,
+          "email" : true,
+          "title" : true,
+          "org" : true,
+          "url" : true
+       },
+       "vcards" : [
+           
+       ] 
+   },
+   {
+       "label" : "public people",
+       "carddavUrl" : "/ucarddav",
+       "path" : "/public",
+       "bookName" : "/people/",
+       "type" : "subscription",
+       "listDisp" : {
+         "name" : false,
+         "familyName" : true,
+         "givenNames" : true,
+         "phone" : true,
+         "email" : true,
+         "title" : true,
+         "org" : true,
+         "url" : true
+       },
+       "detailDisp" : {
+         "phone" : true,
+         "email" : true,
+         "title" : true,
+         "org" : true,
+         "url" : true
+       },
+       "vcards" : [
+             
+       ] 
+   },
+   {
+       "label" : "public locations",
+       "carddavUrl" : "/ucarddav",
+       "path" : "/public",
+       "bookName" : "/locations/",
+       "type" : "subscription",
+       "listDisp" : {
+         "name" : true,
+         "familyName" : false,
+         "givenNames" : false,
+         "phone" : true,
+         "email" : false,
+         "title" : false,
+         "org" : false,
+         "url" : true
+       },
+       "detailDisp" : {
+         "name" : true,
+         "familyName" : false,
+         "givenNames" : false,
+         "phone" : true,
+         "email" : true,
+         "title" : true,
+         "org" : true,
+         "url" : true
+       },
+       "vcards" : [
+             
+       ] 
+   }
+   
+ ];
+
+/*  
+ * Load language file for javascript functions.  
+ * To internationalize, you must also translate 
+ * the index.html file (or swap in a translated
+ * copy).  We will keep a copy of 
+ * translations in the repository  
+ * as they are made available.  
+ */
+
+// Define the language file to be used in the client
+// for javascript functions that generate textual output
+var langfile = "config/lang/en_US.js";
+
+// load the language file
+$.ajax({
+  async: false,
+  type: "GET",
+  url: langfile,
+  data: null,
+  dataType: 'script'
+});


Property changes on: trunk/clients/javascript/bwAddrbookClient/config/configExtended.js
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/clients/javascript/bwAddrbookClient/index.html
===================================================================
--- trunk/clients/javascript/bwAddrbookClient/index.html	2010-10-22 22:13:25 UTC (rev 168)
+++ trunk/clients/javascript/bwAddrbookClient/index.html	2010-10-23 04:24:46 UTC (rev 169)
@@ -71,11 +71,13 @@
         <!-- Books will be built here if any exist  -->
         <li>loading...</li>
       </ul>
+      <!-- Uncomment the following block to include subscriptions in the client -->
+      <!--   
       <h3>subscribed address books</h3>
       <ul class="subscriptions" id="bwSubscriptions">
-        <!-- Books will be built here if any exist -->
         <li>loading...</li>
       </ul>
+      -->
     </div>
     <div id="content" class="ui-layout-center">
       <!-- Each page of the application is modeled below as a list item.

Modified: trunk/clients/javascript/bwAddrbookClient/resources/addressbook.js
===================================================================
--- trunk/clients/javascript/bwAddrbookClient/resources/addressbook.js	2010-10-22 22:13:25 UTC (rev 168)
+++ trunk/clients/javascript/bwAddrbookClient/resources/addressbook.js	2010-10-23 04:24:46 UTC (rev 169)
@@ -499,7 +499,7 @@
         qsParameters[d(e[1])] = d(e[2]);
       }
   })();
-  userid = qsParameters.user;
+  userid = stripHtml(qsParameters.user);
   
   
   // Create the three-panel layout
@@ -719,6 +719,10 @@
   $dialog.dialog('open');
 }
 
+function stripHtml(stringVal) {
+  return stringVal.replace(/<(.|\n)*?>/g, '');
+}
+
 /* UTC FORMATTERS */
 
 // return a formatted UTC month, prepended with zero if needed



More information about the Bedework-commit mailing list