camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r755904 [2/40] - in /camel/trunk/components/camel-web/src/main/webapp/js/dojox: ./ analytics/ analytics/logger/ analytics/plugins/ analytics/profiles/ atom/ atom/io/ atom/widget/ atom/widget/nls/ atom/widget/nls/cs/ atom/widget/nls/de/ atom...
Date Thu, 19 Mar 2009 10:37:20 GMT

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/LICENSE
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/LICENSE?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/LICENSE (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/LICENSE Thu Mar 19 10:37:00 2009
@@ -0,0 +1,195 @@
+Dojo is available under *either* the terms of the modified BSD license *or* the
+Academic Free License version 2.1. As a recipient of Dojo, you may choose which
+license to receive this code under (except as noted in per-module LICENSE
+files). Some modules may not be the copyright of the Dojo Foundation. These
+modules contain explicit declarations of copyright in both the LICENSE files in
+the directories in which they reside and in the code itself. No external
+contributions are allowed under licenses which are fundamentally incompatible
+with the AFL or BSD licenses that Dojo is distributed under.
+
+The text of the AFL and BSD licenses is reproduced below. 
+
+-------------------------------------------------------------------------------
+The "New" BSD License:
+**********************
+
+Copyright (c) 2005-2009, The Dojo Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+  * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+  * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+  * Neither the name of the Dojo Foundation nor the names of its contributors
+    may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------------------
+The Academic Free License, v. 2.1:
+**********************************
+
+This Academic Free License (the "License") applies to any original work of
+authorship (the "Original Work") whose owner (the "Licensor") has placed the
+following notice immediately following the copyright notice for the Original
+Work:
+
+Licensed under the Academic Free License version 2.1
+
+1) Grant of Copyright License. Licensor hereby grants You a world-wide,
+royalty-free, non-exclusive, perpetual, sublicenseable license to do the
+following:
+
+a) to reproduce the Original Work in copies;
+
+b) to prepare derivative works ("Derivative Works") based upon the Original
+Work;
+
+c) to distribute copies of the Original Work and Derivative Works to the
+public;
+
+d) to perform the Original Work publicly; and
+
+e) to display the Original Work publicly.
+
+2) Grant of Patent License. Licensor hereby grants You a world-wide,
+royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
+claims owned or controlled by the Licensor that are embodied in the Original
+Work as furnished by the Licensor, to make, use, sell and offer for sale the
+Original Work and Derivative Works.
+
+3) Grant of Source Code License. The term "Source Code" means the preferred
+form of the Original Work for making modifications to it and all available
+documentation describing how to modify the Original Work. Licensor hereby
+agrees to provide a machine-readable copy of the Source Code of the Original
+Work along with each copy of the Original Work that Licensor distributes.
+Licensor reserves the right to satisfy this obligation by placing a
+machine-readable copy of the Source Code in an information repository
+reasonably calculated to permit inexpensive and convenient access by You for as
+long as Licensor continues to distribute the Original Work, and by publishing
+the address of that information repository in a notice immediately following
+the copyright notice that applies to the Original Work.
+
+4) Exclusions From License Grant. Neither the names of Licensor, nor the names
+of any contributors to the Original Work, nor any of their trademarks or
+service marks, may be used to endorse or promote products derived from this
+Original Work without express prior written permission of the Licensor. Nothing
+in this License shall be deemed to grant any rights to trademarks, copyrights,
+patents, trade secrets or any other intellectual property of Licensor except as
+expressly stated herein. No patent license is granted to make, use, sell or
+offer to sell embodiments of any patent claims other than the licensed claims
+defined in Section 2. No right is granted to the trademarks of Licensor even if
+such marks are included in the Original Work. Nothing in this License shall be
+interpreted to prohibit Licensor from licensing under different terms from this
+License any Original Work that Licensor otherwise would have a right to
+license.
+
+5) This section intentionally omitted.
+
+6) Attribution Rights. You must retain, in the Source Code of any Derivative
+Works that You create, all copyright, patent or trademark notices from the
+Source Code of the Original Work, as well as any notices of licensing and any
+descriptive text identified therein as an "Attribution Notice." You must cause
+the Source Code for any Derivative Works that You create to carry a prominent
+Attribution Notice reasonably calculated to inform recipients that You have
+modified the Original Work.
+
+7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
+the copyright in and to the Original Work and the patent rights granted herein
+by Licensor are owned by the Licensor or are sublicensed to You under the terms
+of this License with the permission of the contributor(s) of those copyrights
+and patent rights. Except as expressly stated in the immediately proceeding
+sentence, the Original Work is provided under this License on an "AS IS" BASIS
+and WITHOUT WARRANTY, either express or implied, including, without limitation,
+the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
+This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
+license to Original Work is granted hereunder except under this disclaimer.
+
+8) Limitation of Liability. Under no circumstances and under no legal theory,
+whether in tort (including negligence), contract, or otherwise, shall the
+Licensor be liable to any person for any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License
+or the use of the Original Work including, without limitation, damages for loss
+of goodwill, work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses. This limitation of liability shall not
+apply to liability for death or personal injury resulting from Licensor's
+negligence to the extent applicable law prohibits such limitation. Some
+jurisdictions do not allow the exclusion or limitation of incidental or
+consequential damages, so this exclusion and limitation may not apply to You.
+
+9) Acceptance and Termination. If You distribute copies of the Original Work or
+a Derivative Work, You must make a reasonable effort under the circumstances to
+obtain the express assent of recipients to the terms of this License. Nothing
+else but this License (or another written agreement between Licensor and You)
+grants You permission to create Derivative Works based upon the Original Work
+or to exercise any of the rights granted in Section 1 herein, and any attempt
+to do so except under the terms of this License (or another written agreement
+between Licensor and You) is expressly prohibited by U.S. copyright law, the
+equivalent laws of other countries, and by international treaty. Therefore, by
+exercising any of the rights granted to You in Section 1 herein, You indicate
+Your acceptance of this License and all of its terms and conditions.
+
+10) Termination for Patent Action. This License shall terminate automatically
+and You may no longer exercise any of the rights granted to You by this License
+as of the date You commence an action, including a cross-claim or counterclaim,
+against Licensor or any licensee alleging that the Original Work infringes a
+patent. This termination provision shall not apply for an action alleging
+patent infringement by combinations of the Original Work with other software or
+hardware.
+
+11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
+License may be brought only in the courts of a jurisdiction wherein the
+Licensor resides or in which Licensor conducts its primary business, and under
+the laws of that jurisdiction excluding its conflict-of-law provisions. The
+application of the United Nations Convention on Contracts for the International
+Sale of Goods is expressly excluded. Any use of the Original Work outside the
+scope of this License or after its termination shall be subject to the
+requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et
+seq., the equivalent laws of other countries, and international treaty. This
+section shall survive the termination of this License.
+
+12) Attorneys Fees. In any action to enforce the terms of this License or
+seeking damages relating thereto, the prevailing party shall be entitled to
+recover its costs and expenses, including, without limitation, reasonable
+attorneys' fees and costs incurred in connection with such action, including
+any appeal of such action. This section shall survive the termination of this
+License.
+
+13) Miscellaneous. This License represents the complete agreement concerning
+the subject matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent necessary to
+make it enforceable.
+
+14) Definition of "You" in This License. "You" throughout this License, whether
+in upper or lower case, means an individual or a legal entity exercising rights
+under, and complying with all of the terms of, this License. For legal
+entities, "You" includes any entity that controls, is controlled by, or is
+under common control with you. For purposes of this definition, "control" means
+(i) the power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty percent
+(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
+entity.
+
+15) Right to Use. You may use the Original Work in all ways not otherwise
+restricted or conditioned by this License or by law, and Licensor promises not
+to interfere with or be responsible for such uses by You.
+
+This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
+Permission is hereby granted to copy and distribute this license without
+modification. This license may not be modified without the express written
+permission of its copyright owner.

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,12 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.analytics"]){
+dojo._hasResource["dojox.analytics"]=true;
+dojo.provide("dojox.analytics");
+dojo.require("dojox.analytics._base");
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/README
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/README?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/README (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/README Thu Mar 19 10:37:00 2009
@@ -0,0 +1,139 @@
+-------------------------------------------------------------------------------
+dojox.analytics
+-------------------------------------------------------------------------------
+Version 1.0
+Release date: 12/17/2007
+-------------------------------------------------------------------------------
+Project state: 
+[base]: alpha
+[Urchin]: alpha
+-------------------------------------------------------------------------------
+Project authors
+	Dustin Machi  (dmachi)
+	Peter Higgins (dante)
+-------------------------------------------------------------------------------
+Project description
+	analytics and client monitoring system.  Including the base analytics
+system and any number of plugins enables logging of different system data
+back to the server.  Plugins included at this time:
+
+	dojo - reports dojo startup  collected information
+	window - reports available window information to the server
+	mouseOver - allows periodic sampling of mouseOver 
+	mouseClick - reports any mouse clicks to the server
+	idle - reports idle/activity 
+	consoleMessages - reports console.* messages to the server	
+
+	Additionally, a Google Ananlytics (Urchin tracker) helper is included
+	in this project, though is unrelated to the Core dojox.analytics 
+	project code. 
+
+-------------------------------------------------------------------------------
+Dependencies:
+
+Dojo Core (package loader).
+-------------------------------------------------------------------------------
+Documentation
+
+Usage:
+
+The primary intended usage will be to create a custom build layer that includes 
+the particular plugins you need for your project.   However in practice you
+can use the system as such:
+
+	<script type="text/javascript" src="../../../dojo/dojo.js"
+                djConfig="parseOnLoad: true, isDebug: false, usePlainJson: true, sendMethod: 'script', sendInterval: 5000"></script>
+
+        <script language="JavaScript" type="text/javascript">
+                // include the analytics system
+                dojo.require("dojox.analytics");
+
+                //tracks mouse clicks on the page
+                dojo.require("dojox.analytics.plugins.mouseClick");
+
+                // this plugin returns the informatin dojo collects when it launches
+                dojo.require("dojox.analytics.plugins.dojo");
+
+                // this plugin return the information the window has when it launches
+                // and it also ties to a few events such as window.option
+                dojo.require("dojox.analytics.plugins.window");
+
+                // this plugin tracks console. message, It logs console.error, warn, and
+                // info messages to the tracker.  It also defines console.rlog() which
+                // can be used to log only to the server.  Note that if isDebug() is disabled
+                // you will still see the console messages on the sever, but not in the actual
+                // browser console.
+                dojo.require("dojox.analytics.plugins.consoleMessages");
+
+                // tracks where a mouse is on a page an what it is over, periodically sampling
+                // and storing this data
+                dojo.require("dojox.analytics.plugins.mouseOver");
+
+                //tracks when the user has gone idle
+                dojo.require("dojox.analytics.plugins.idle");
+
+	</script> 
+
+When done using a build, none of the dojo.require() statement will be requires 
+would already be in the build. 
+
+Most of the plugins and the base itself have a number of configurable params
+that are passed in via the djConfig variable set.  This approach is taken so that
+the parameters can be easily provided in the case of a build or for a custom
+dojo.js build with analytics built in. Examples for different build profiles 
+are in the profiles directory.
+
+Available Configuration Parameters:
+
+	Base Configs
+	sendInterval - Normal send interval. Default 5000 
+	sendMethod - "script" || "xhrPost"
+	inTransitRetry - Delay before retrying an a send if it was in transit
+			or if there is still data to be sent after a post.
+			Default 1000
+	analyticsUrl - url to send logging data to. defaults to the test php 
+			file for now
+	maxRequestSize - Maximum size of GET style requests. Capped at 2000 for 
+			IE, and 4000 otherwise	
+
+	consoleMessages Config:
+
+	consoleLogFuncs - functions from the console object that you will log to 
+			the server. If the console object doesn't exist
+			or a particuarl method doesn't exist it will be
+			created as a remote logging only method. This provides
+			a quick and convient way to automatically define
+			a remote logging funciton that includes the functions
+			name in the log.  The 'rlog' in the default paramerters
+			is an example of this.  Defaults to ["error", "warn", "info", "rlog"]	
+
+	idle Config:
+	
+		idleTime - Number of ms to be idle before being reported to the server as idle
+
+	mouseOver config:
+		targetProps - the properties whose values will be reported for each target from
+				a mouse over sample.  defaults to ["id","className","localName","href", "spellcheck", "lang", "textContent", "value" ]
+
+		sampleDelay - the delay in ms between mouseover samples. Defaults to 2500
+
+	window config:
+		windowConnects - methods on the window objec that will be attached to 
+				have its data passed to the server when called.
+
+	
+Note that the basic usage of this system simply serializes json with toJson() when passed
+to the analytics addData() method.  If data is passed that has circular references
+it will die.  Take care not to do that or be surprised when it doens't work
+in those cases.
+
+-------------------------------------------------------------------------------
+Installation instructions
+
+Grab the following from the Dojo SVN Repository:
+http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/analytics
+
+Install into the following directory structure:
+/dojox/analytics/
+
+...which should be at the same level as your Dojo checkout.

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/README
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/Urchin.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/Urchin.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/Urchin.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/Urchin.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,34 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.analytics.Urchin"]){
+dojo._hasResource["dojox.analytics.Urchin"]=true;
+dojo.provide("dojox.analytics.Urchin");
+dojo.declare("dojox.analytics.Urchin",null,{acct:dojo.config.urchin,loadInterval:42,decay:0.5,timeout:4200,constructor:function(_1){
+this.tracker=null;
+dojo.mixin(this,_1);
+this._loadGA();
+},_loadGA:function(){
+var _2=("https:"==document.location.protocol)?"https://ssl.":"http://www.";
+dojo.create("script",{src:_2+"google-analytics.com/ga.js"},dojo.doc.getElementsByTagName("head")[0]);
+setTimeout(dojo.hitch(this,"_checkGA"),this.loadInterval);
+},_checkGA:function(){
+if(this.loadInterval>this.timeout){
+return;
+}
+setTimeout(dojo.hitch(this,!window["_gat"]?"_checkGA":"_gotGA"),this.loadInterval);
+this.loadInterval*=(this.decay+1);
+},_gotGA:function(){
+this.tracker=_gat._getTracker(this.acct);
+this.tracker._initData();
+this.GAonLoad.apply(this,arguments);
+},GAonLoad:function(){
+this.trackPageView();
+},trackPageView:function(_3){
+this.tracker._trackPageview.apply(this,arguments);
+}});
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/Urchin.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/_base.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/_base.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/_base.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/_base.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,82 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.analytics._base"]){
+dojo._hasResource["dojox.analytics._base"]=true;
+dojo.provide("dojox.analytics._base");
+dojox.analytics=function(){
+this._data=[];
+this._id=1;
+this.sendInterval=dojo.config["sendInterval"]||5000;
+this.inTransitRetry=dojo.config["inTransitRetry"]||200;
+this.dataUrl=dojo.config["analyticsUrl"]||dojo.moduleUrl("dojox.analytics.logger","dojoxAnalytics.php");
+this.sendMethod=dojo.config["sendMethod"]||"xhrPost";
+this.maxRequestSize=dojo.isIE?2000:dojo.config["maxRequestSize"]||4000;
+dojo.addOnLoad(this,"schedulePusher");
+dojo.addOnUnload(this,"pushData",true);
+};
+dojo.extend(dojox.analytics,{schedulePusher:function(_1){
+setTimeout(dojo.hitch(this,"checkData"),_1||this.sendInterval);
+},addData:function(_2,_3){
+if(arguments.length>2){
+var c=[];
+for(var i=1;i<arguments.length;i++){
+c.push(arguments[i]);
+}
+_3=c;
+}
+this._data.push({plugin:_2,data:_3});
+},checkData:function(){
+if(this._inTransit){
+this.schedulePusher(this.inTransitRetry);
+return;
+}
+if(this.pushData()){
+return;
+}
+this.schedulePusher();
+},pushData:function(){
+if(this._data.length){
+this._inTransit=this._data;
+this._data=[];
+var _6;
+switch(this.sendMethod){
+case "script":
+_6=dojo.io.script.get({url:this.getQueryPacket(),preventCache:1,callbackParamName:"callback"});
+break;
+case "xhrPost":
+default:
+_6=dojo.xhrPost({url:this.dataUrl,content:{id:this._id++,data:dojo.toJson(this._inTransit)}});
+break;
+}
+_6.addCallback(this,"onPushComplete");
+return _6;
+}
+return false;
+},getQueryPacket:function(){
+while(true){
+var _7={id:this._id++,data:dojo.toJson(this._inTransit)};
+var _8=this.dataUrl+"?"+dojo.objectToQuery(_7);
+if(_8.length>this.maxRequestSize){
+this._data.unshift(this._inTransit.pop());
+this._split=1;
+}else{
+return _8;
+}
+}
+},onPushComplete:function(_9){
+if(this._inTransit){
+delete this._inTransit;
+}
+if(this._data.length>0){
+this.schedulePusher(this.inTransitRetry);
+}else{
+this.schedulePusher();
+}
+}});
+dojox.analytics=new dojox.analytics();
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/_base.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/logger/JSON.php
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/logger/JSON.php?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/logger/JSON.php (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/logger/JSON.php Thu Mar 19 10:37:00 2009
@@ -0,0 +1,724 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/** 
+ * Converts to and from JSON format.
+ * 
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
+ * format. It is easy for humans to read and write. It is easy for machines
+ * to parse and generate. It is based on a subset of the JavaScript
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
+ * This feature can also be found in  Python. JSON is a text format that is
+ * completely language independent but uses conventions that are familiar
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
+ * ideal data-interchange language.
+ * 
+ * This package provides a simple encoder and decoder for JSON notation. It
+ * is intended for use with client-side Javascript applications that make
+ * use of HTTPRequest to perform server communication functions - data can
+ * be encoded into JSON notation for use in a client-side javascript, or
+ * decoded from incoming Javascript requests. JSON format is native to
+ * Javascript, and can be directly eval()'ed with no further parsing
+ * overhead
+ *
+ * All strings should be in ASCII or UTF-8 format!
+ *
+ * LICENSE: Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met: Redistributions of source code must retain the
+ * above copyright notice, this list of conditions and the following
+ * disclaimer. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ * 
+ * @category   
+ * @package     Services_JSON
+ * @author      Michal Migurski <mike-json@teczno.com>
+ * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
+ * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
+ * @copyright   2005 Michal Migurski
+ * @license     http://www.opensource.org/licenses/bsd-license.php
+ * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
+ */
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_SLICE',   1);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_STR',  2);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_ARR',  4);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_OBJ',  8);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_CMT', 16);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_LOOSE_TYPE', 10);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_STRICT_TYPE', 11);
+
+/** 
+ * Converts to and from JSON format.
+ *
+ * Brief example of use:
+ *
+ * <code>
+ * // create a new instance of Services_JSON
+ * $json = new Services_JSON();
+ * 
+ * // convert a complexe value to JSON notation, and send it to the browser
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
+ * $output = $json->encode($value);
+ *
+ * print($output);
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
+ * 
+ * // accept incoming POST data, assumed to be in JSON notation
+ * $input = file_get_contents('php://input', 1000000);
+ * $value = $json->decode($input);
+ * </code>
+ */
+class Services_JSON
+{
+   /**
+    * constructs a new JSON instance
+    *
+    * @param    int     $use    object behavior: when encoding or decoding,
+    *                           be loose or strict about object/array usage
+    *
+    *                           possible values:
+    *                           - SERVICES_JSON_STRICT_TYPE: strict typing, default.
+    *                                                        "{...}" syntax creates objects in decode().
+    *                           - SERVICES_JSON_LOOSE_TYPE:  loose typing.
+    *                                                        "{...}" syntax creates associative arrays in decode().
+    */
+    function Services_JSON($use = SERVICES_JSON_STRICT_TYPE)
+    {
+        $this->use = $use;
+    }
+
+   /**
+    * convert a string from one UTF-16 char to one UTF-8 char
+    *
+    * Normally should be handled by mb_convert_encoding, but
+    * provides a slower PHP-only method for installations
+    * that lack the multibye string extension.
+    *
+    * @param    string  $utf16  UTF-16 character
+    * @return   string  UTF-8 character
+    * @access   private
+    */
+    function utf162utf8($utf16)
+    {
+        // oh please oh please oh please oh please oh please
+        if(function_exists('mb_convert_encoding'))
+            return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
+        
+        $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
+
+        switch(true) {
+            case ((0x7F & $bytes) == $bytes):
+                // this case should never be reached, because we are in ASCII range
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0x7F & $bytes);
+
+            case (0x07FF & $bytes) == $bytes:
+                // return a 2-byte UTF-8 character
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0xC0 | (($bytes >> 6) & 0x1F))
+                     . chr(0x80 | ($bytes & 0x3F));
+
+            case (0xFFFF & $bytes) == $bytes:
+                // return a 3-byte UTF-8 character
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0xE0 | (($bytes >> 12) & 0x0F))
+                     . chr(0x80 | (($bytes >> 6) & 0x3F))
+                     . chr(0x80 | ($bytes & 0x3F));
+        }
+
+        // ignoring UTF-32 for now, sorry
+        return '';
+    }        
+
+   /**
+    * convert a string from one UTF-8 char to one UTF-16 char
+    *
+    * Normally should be handled by mb_convert_encoding, but
+    * provides a slower PHP-only method for installations
+    * that lack the multibye string extension.
+    *
+    * @param    string  $utf8   UTF-8 character
+    * @return   string  UTF-16 character
+    * @access   private
+    */
+    function utf82utf16($utf8)
+    {
+        // oh please oh please oh please oh please oh please
+        if(function_exists('mb_convert_encoding'))
+            return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+        
+        switch(strlen($utf8)) {
+            case 1:
+                // this case should never be reached, because we are in ASCII range
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return $utf8;
+
+            case 2:
+                // return a UTF-16 character from a 2-byte UTF-8 char
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0x07 & (ord($utf8{0}) >> 2))
+                     . chr((0xC0 & (ord($utf8{0}) << 6))
+                         | (0x3F & ord($utf8{1})));
+                
+            case 3:
+                // return a UTF-16 character from a 3-byte UTF-8 char
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr((0xF0 & (ord($utf8{0}) << 4))
+                         | (0x0F & (ord($utf8{1}) >> 2)))
+                     . chr((0xC0 & (ord($utf8{1}) << 6))
+                         | (0x7F & ord($utf8{2})));
+        }
+
+        // ignoring UTF-32 for now, sorry
+        return '';
+    }        
+
+   /**
+    * encodes an arbitrary variable into JSON format
+    *
+    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
+    *                           see argument 1 to Services_JSON() above for array-parsing behavior.
+    *                           if var is a strng, note that encode() always expects it
+    *                           to be in ASCII or UTF-8 format!
+    *
+    * @return   string  JSON string representation of input var
+    * @access   public
+    */
+    function encode($var)
+    {
+        switch (gettype($var)) {
+            case 'boolean':
+                return $var ? 'true' : 'false';
+            
+            case 'NULL':
+                return 'null';
+            
+            case 'integer':
+                return (int) $var;
+                
+            case 'double':
+            case 'float':
+                return (float) $var;
+                
+            case 'string':
+                // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
+                $ascii = '';
+                $strlen_var = strlen($var);
+
+               /*
+                * Iterate over every character in the string,
+                * escaping with a slash or encoding to UTF-8 where necessary
+                */
+                for ($c = 0; $c < $strlen_var; ++$c) {
+                    
+                    $ord_var_c = ord($var{$c});
+                    
+                    switch (true) {
+                        case $ord_var_c == 0x08:
+                            $ascii .= '\b';
+                            break;
+                        case $ord_var_c == 0x09:
+                            $ascii .= '\t';
+                            break;
+                        case $ord_var_c == 0x0A:
+                            $ascii .= '\n';
+                            break;
+                        case $ord_var_c == 0x0C:
+                            $ascii .= '\f';
+                            break;
+                        case $ord_var_c == 0x0D:
+                            $ascii .= '\r';
+                            break;
+
+                        case $ord_var_c == 0x22:
+                        case $ord_var_c == 0x2F:
+                        case $ord_var_c == 0x5C:
+                            // double quote, slash, slosh
+                            $ascii .= '\\'.$var{$c};
+                            break;
+                            
+                        case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
+                            // characters U-00000000 - U-0000007F (same as ASCII)
+                            $ascii .= $var{$c};
+                            break;
+                        
+                        case (($ord_var_c & 0xE0) == 0xC0):
+                            // characters U-00000080 - U-000007FF, mask 110XXXXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+                            $c += 1;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+    
+                        case (($ord_var_c & 0xF0) == 0xE0):
+                            // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}));
+                            $c += 2;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+    
+                        case (($ord_var_c & 0xF8) == 0xF0):
+                            // characters U-00010000 - U-001FFFFF, mask 11110XXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}));
+                            $c += 3;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+    
+                        case (($ord_var_c & 0xFC) == 0xF8):
+                            // characters U-00200000 - U-03FFFFFF, mask 111110XX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}),
+                                         ord($var{$c + 4}));
+                            $c += 4;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+    
+                        case (($ord_var_c & 0xFE) == 0xFC):
+                            // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}),
+                                         ord($var{$c + 4}),
+                                         ord($var{$c + 5}));
+                            $c += 5;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+                    }
+                }
+                
+                return '"'.$ascii.'"';
+                
+            case 'array':
+               /*
+                * As per JSON spec if any array key is not an integer
+                * we must treat the the whole array as an object. We
+                * also try to catch a sparsely populated associative
+                * array with numeric keys here because some JS engines
+                * will create an array with empty indexes up to
+                * max_index which can cause memory issues and because
+                * the keys, which may be relevant, will be remapped
+                * otherwise.
+                * 
+                * As per the ECMA and JSON specification an object may
+                * have any string as a property. Unfortunately due to
+                * a hole in the ECMA specification if the key is a
+                * ECMA reserved word or starts with a digit the
+                * parameter is only accessible using ECMAScript's
+                * bracket notation.
+                */
+                
+                // treat as a JSON object  
+                if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
+                    return '{' .
+                           join(',', array_map(array($this, 'name_value'),
+                                               array_keys($var),
+                                               array_values($var)))
+                           . '}';
+                }
+
+                // treat it like a regular array
+                return '[' . join(',', array_map(array($this, 'encode'), $var)) . ']';
+                
+            case 'object':
+                $vars = get_object_vars($var);
+                return '{' .
+                       join(',', array_map(array($this, 'name_value'),
+                                           array_keys($vars),
+                                           array_values($vars)))
+                       . '}';
+
+            default:
+                return '';
+        }
+    }
+    
+   /**
+    * array-walking function for use in generating JSON-formatted name-value pairs
+    *
+    * @param    string  $name   name of key to use
+    * @param    mixed   $value  reference to an array element to be encoded
+    *
+    * @return   string  JSON-formatted name-value pair, like '"name":value'
+    * @access   private
+    */
+    function name_value($name, $value)
+    {
+        return $this->encode(strval($name)) . ':' . $this->encode($value);
+    }        
+
+   /**
+    * reduce a string by removing leading and trailing comments and whitespace
+    *
+    * @param    $str    string      string value to strip of comments and whitespace
+    *
+    * @return   string  string value stripped of comments and whitespace
+    * @access   private
+    */
+    function reduce_string($str)
+    {
+        $str = preg_replace(array(
+        
+                // eliminate single line comments in '// ...' form
+                '#^\s*//(.+)$#m',
+    
+                // eliminate multi-line comments in '/* ... */' form, at start of string
+                '#^\s*/\*(.+)\*/#Us',
+    
+                // eliminate multi-line comments in '/* ... */' form, at end of string
+                '#/\*(.+)\*/\s*$#Us'
+    
+            ), '', $str);
+        
+        // eliminate extraneous space
+        return trim($str);
+    }
+
+   /**
+    * decodes a JSON string into appropriate variable
+    *
+    * @param    string  $str    JSON-formatted string
+    *
+    * @return   mixed   number, boolean, string, array, or object
+    *                   corresponding to given JSON input string.
+    *                   See argument 1 to Services_JSON() above for object-output behavior.
+    *                   Note that decode() always returns strings
+    *                   in ASCII or UTF-8 format!
+    * @access   public
+    */
+    function decode($str)
+    {
+        $str = $this->reduce_string($str);
+    
+        switch (strtolower($str)) {
+            case 'true':
+                return true;
+
+            case 'false':
+                return false;
+            
+            case 'null':
+                return null;
+            
+            default:
+                if (is_numeric($str)) {
+                    // Lookie-loo, it's a number
+
+                    // This would work on its own, but I'm trying to be
+                    // good about returning integers where appropriate:
+                    // return (float)$str;
+
+                    // Return float or int, as appropriate
+                    return ((float)$str == (integer)$str)
+                        ? (integer)$str
+                        : (float)$str;
+                    
+                } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
+                    // STRINGS RETURNED IN UTF-8 FORMAT
+                    $delim = substr($str, 0, 1);
+                    $chrs = substr($str, 1, -1);
+                    $utf8 = '';
+                    $strlen_chrs = strlen($chrs);
+                    
+                    for ($c = 0; $c < $strlen_chrs; ++$c) {
+                    
+                        $substr_chrs_c_2 = substr($chrs, $c, 2);
+                        $ord_chrs_c = ord($chrs{$c});
+                        
+                        switch (true) {
+                            case $substr_chrs_c_2 == '\b':
+                                $utf8 .= chr(0x08);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\t':
+                                $utf8 .= chr(0x09);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\n':
+                                $utf8 .= chr(0x0A);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\f':
+                                $utf8 .= chr(0x0C);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\r':
+                                $utf8 .= chr(0x0D);
+                                ++$c;
+                                break;
+
+                            case $substr_chrs_c_2 == '\\"':
+                            case $substr_chrs_c_2 == '\\\'':
+                            case $substr_chrs_c_2 == '\\\\':
+                            case $substr_chrs_c_2 == '\\/':
+                                if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
+                                   ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
+                                    $utf8 .= $chrs{++$c};
+                                }
+                                break;
+                                
+                            case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
+                                // single, escaped unicode character
+                                $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
+                                       . chr(hexdec(substr($chrs, ($c + 4), 2)));
+                                $utf8 .= $this->utf162utf8($utf16);
+                                $c += 5;
+                                break;
+        
+                            case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
+                                $utf8 .= $chrs{$c};
+                                break;
+        
+                            case ($ord_chrs_c & 0xE0) == 0xC0:
+                                // characters U-00000080 - U-000007FF, mask 110XXXXX
+                                //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 2);
+                                ++$c;
+                                break;
+    
+                            case ($ord_chrs_c & 0xF0) == 0xE0:
+                                // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 3);
+                                $c += 2;
+                                break;
+    
+                            case ($ord_chrs_c & 0xF8) == 0xF0:
+                                // characters U-00010000 - U-001FFFFF, mask 11110XXX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 4);
+                                $c += 3;
+                                break;
+    
+                            case ($ord_chrs_c & 0xFC) == 0xF8:
+                                // characters U-00200000 - U-03FFFFFF, mask 111110XX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 5);
+                                $c += 4;
+                                break;
+    
+                            case ($ord_chrs_c & 0xFE) == 0xFC:
+                                // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 6);
+                                $c += 5;
+                                break;
+
+                        }
+
+                    }
+                    
+                    return $utf8;
+                
+                } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
+                    // array, or object notation
+
+                    if ($str{0} == '[') {
+                        $stk = array(SERVICES_JSON_IN_ARR);
+                        $arr = array();
+                    } else {
+                        if ($this->use == SERVICES_JSON_LOOSE_TYPE) {
+                            $stk = array(SERVICES_JSON_IN_OBJ);
+                            $obj = array();
+                        } else {
+                            $stk = array(SERVICES_JSON_IN_OBJ);
+                            $obj = new stdClass();
+                        }
+                    }
+                    
+                    array_push($stk, array('what'  => SERVICES_JSON_SLICE,
+                                           'where' => 0,
+                                           'delim' => false));
+
+                    $chrs = substr($str, 1, -1);
+                    $chrs = $this->reduce_string($chrs);
+                    
+                    if ($chrs == '') {
+                        if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                            return $arr;
+
+                        } else {
+                            return $obj;
+
+                        }
+                    }
+
+                    //print("\nparsing {$chrs}\n");
+                    
+                    $strlen_chrs = strlen($chrs);
+                    
+                    for ($c = 0; $c <= $strlen_chrs; ++$c) {
+                    
+                        $top = end($stk);
+                        $substr_chrs_c_2 = substr($chrs, $c, 2);
+                    
+                        if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
+                            // found a comma that is not inside a string, array, etc.,
+                            // OR we've reached the end of the character list
+                            $slice = substr($chrs, $top['where'], ($c - $top['where']));
+                            array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
+                            //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                            if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                                // we are in an array, so just push an element onto the stack
+                                array_push($arr, $this->decode($slice));
+
+                            } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+                                // we are in an object, so figure
+                                // out the property name and set an
+                                // element in an associative array,
+                                // for now
+                                if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+                                    // "name":value pair
+                                    $key = $this->decode($parts[1]);
+                                    $val = $this->decode($parts[2]);
+
+                                    if ($this->use == SERVICES_JSON_LOOSE_TYPE) {
+                                        $obj[$key] = $val;
+                                    } else {
+                                        $obj->$key = $val;
+                                    }
+                                } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+                                    // name:value pair, where name is unquoted
+                                    $key = $parts[1];
+                                    $val = $this->decode($parts[2]);
+
+                                    if ($this->use == SERVICES_JSON_LOOSE_TYPE) {
+                                        $obj[$key] = $val;
+                                    } else {
+                                        $obj->$key = $val;
+                                    }
+                                }
+
+                            }
+
+                        } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
+                            // found a quote, and we are not inside a string
+                            array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
+                            //print("Found start of string at {$c}\n");
+
+                        } elseif (($chrs{$c} == $top['delim']) &&
+                                 ($top['what'] == SERVICES_JSON_IN_STR) &&
+                                 (($chrs{$c - 1} != '\\') ||
+                                 ($chrs{$c - 1} == '\\' && $chrs{$c - 2} == '\\'))) {
+                            // found a quote, we're in a string, and it's not escaped
+                            array_pop($stk);
+                            //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
+
+                        } elseif (($chrs{$c} == '[') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a left-bracket, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
+                            //print("Found start of array at {$c}\n");
+
+                        } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
+                            // found a right-bracket, and we're in an array
+                            array_pop($stk);
+                            //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        } elseif (($chrs{$c} == '{') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a left-brace, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
+                            //print("Found start of object at {$c}\n");
+
+                        } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
+                            // found a right-brace, and we're in an object
+                            array_pop($stk);
+                            //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        } elseif (($substr_chrs_c_2 == '/*') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a comment start, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
+                            $c++;
+                            //print("Found start of comment at {$c}\n");
+
+                        } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
+                            // found a comment end, and we're in one now
+                            array_pop($stk);
+                            $c++;
+                            
+                            for ($i = $top['where']; $i <= $c; ++$i)
+                                $chrs = substr_replace($chrs, ' ', $i, 1);
+                            
+                            //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        }
+                    
+                    }
+                    
+                    if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                        return $arr;
+
+                    } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+                        return $obj;
+
+                    }
+                
+                }
+        }
+    }
+    
+}
+    
+?>
\ No newline at end of file

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/logger/dojoxAnalytics.php
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/logger/dojoxAnalytics.php?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/logger/dojoxAnalytics.php (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/logger/dojoxAnalytics.php Thu Mar 19 10:37:00 2009
@@ -0,0 +1,31 @@
+<?php
+	require_once("./JSON.php");
+
+	$filename = "./logs/analytics.log";
+	$json = new Services_JSON;
+
+	$id = $_REQUEST["id"];
+	$items = $json->decode($_REQUEST["data"]);
+
+	if (!$handle = fopen($filename, 'a+')) {
+		print '{error: "server error"}';
+		exit;
+	}
+
+	foreach($items as $i=>$item){
+		$item->_analyticsId = $id;
+		$item->_analyticsTimeStamp = time();
+		$log = $json->encode($item) . "\n";
+		fwrite($handle, $log);
+	}
+	
+	fclose($handle);
+
+	$response = "{'eventsRecieved': '" . sizeof($items) . "', 'id': '" . $id . "'}";
+	if ($_REQUEST["callback"]){
+		print $_REQUEST["callback"] . "(" . $response . ");";
+	}else{
+		print $response;
+	}
+	
+?>

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/consoleMessages.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/consoleMessages.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/consoleMessages.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/consoleMessages.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,25 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.analytics.plugins.consoleMessages"]){
+dojo._hasResource["dojox.analytics.plugins.consoleMessages"]=true;
+dojo.provide("dojox.analytics.plugins.consoleMessages");
+dojox.analytics.plugins.consoleMessages=new (function(){
+this.addData=dojo.hitch(dojox.analytics,"addData","consoleMessages");
+var _1=dojo.config["consoleLogFuncs"]||["error","warn","info","rlog"];
+if(!console){
+console={};
+}
+for(var i=0;i<_1.length;i++){
+if(console[_1[i]]){
+dojo.connect(console,_1[i],dojo.hitch(this,"addData",_1[i]));
+}else{
+console[_1[i]]=dojo.hitch(this,"addData",_1[i]);
+}
+}
+})();
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/consoleMessages.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/dojo.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/dojo.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/dojo.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/dojo.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,22 @@
+if(!dojo._hasResource["dojox.analytics.plugins.dojo"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.analytics.plugins.dojo"] = true;
+dojo.provide("dojox.analytics.plugins.dojo");
+
+dojox.analytics.plugins.dojo = new (function(){
+	// summary:
+	//	plugin to have analyitcs return the base info dojo collects
+	this.addData = dojo.hitch(dojox.analytics, "addData", "dojo");
+	dojo.addOnLoad(dojo.hitch(this, function(){
+		var data = {};
+		for(var i in dojo){
+			if ((i=="version") || ((!dojo.isObject(dojo[i]))&&(i[0]!="_"))){
+				data[i]=dojo[i];
+			}
+		}
+
+		if (dojo.config){data.djConfig=dojo.config}
+		this.addData(data);
+	}));
+})();
+
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/dojo.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/idle.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/idle.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/idle.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/idle.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,35 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.analytics.plugins.idle"]){
+dojo._hasResource["dojox.analytics.plugins.idle"]=true;
+dojo.provide("dojox.analytics.plugins.idle");
+dojox.analytics.plugins.idle=new (function(){
+this.addData=dojo.hitch(dojox.analytics,"addData","idle");
+this.idleTime=dojo.config["idleTime"]||60000;
+this.idle=true;
+this.setIdle=function(){
+this.addData("isIdle");
+this.idle=true;
+};
+dojo.addOnLoad(dojo.hitch(this,function(){
+var _1=["onmousemove","onkeydown","onclick","onscroll"];
+for(var i=0;i<_1.length;i++){
+dojo.connect(dojo.doc,_1[i],this,function(e){
+if(this.idle){
+this.idle=false;
+this.addData("isActive");
+this.idleTimer=setTimeout(dojo.hitch(this,"setIdle"),this.idleTime);
+}else{
+clearTimeout(this.idleTimer);
+this.idleTimer=setTimeout(dojo.hitch(this,"setIdle"),this.idleTime);
+}
+});
+}
+}));
+})();
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/idle.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseClick.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseClick.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseClick.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseClick.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,51 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.analytics.plugins.mouseClick"]){
+dojo._hasResource["dojox.analytics.plugins.mouseClick"]=true;
+dojo.provide("dojox.analytics.plugins.mouseClick");
+dojox.analytics.plugins.mouseClick=new (function(){
+this.addData=dojo.hitch(dojox.analytics,"addData","mouseClick");
+this.onClick=function(e){
+this.addData(this.trimEvent(e));
+};
+dojo.connect(dojo.doc,"onclick",this,"onClick");
+this.trimEvent=function(e){
+var t={};
+for(var i in e){
+switch(i){
+case "target":
+case "originalTarget":
+case "explicitOriginalTarget":
+var _5=["id","className","nodeName","localName","href","spellcheck","lang"];
+t[i]={};
+for(var j=0;j<_5.length;j++){
+if(e[i][_5[j]]){
+if(_5[j]=="text"||_5[j]=="textContent"){
+if((e[i]["localName"]!="HTML")&&(e[i]["localName"]!="BODY")){
+t[i][_5[j]]=e[i][_5[j]].substr(0,50);
+}
+}else{
+t[i][_5[j]]=e[i][_5[j]];
+}
+}
+}
+break;
+case "clientX":
+case "clientY":
+case "pageX":
+case "pageY":
+case "screenX":
+case "screenY":
+t[i]=e[i];
+break;
+}
+}
+return t;
+};
+})();
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseClick.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseOver.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseOver.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseOver.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseOver.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,76 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.analytics.plugins.mouseOver"]){
+dojo._hasResource["dojox.analytics.plugins.mouseOver"]=true;
+dojo.provide("dojox.analytics.plugins.mouseOver");
+dojox.analytics.plugins.mouseOver=new (function(){
+this.watchMouse=dojo.config["watchMouseOver"]||true;
+this.mouseSampleDelay=dojo.config["sampleDelay"]||2500;
+this.addData=dojo.hitch(dojox.analytics,"addData","mouseOver");
+this.targetProps=dojo.config["targetProps"]||["id","className","localName","href","spellcheck","lang","textContent","value"];
+this.toggleWatchMouse=function(){
+if(this._watchingMouse){
+dojo.disconnect(this._watchingMouse);
+delete this._watchingMouse;
+return;
+}
+dojo.connect(dojo.doc,"onmousemove",this,"sampleMouse");
+};
+if(this.watchMouse){
+dojo.connect(dojo.doc,"onmouseover",this,"toggleWatchMouse");
+dojo.connect(dojo.doc,"onmouseout",this,"toggleWatchMouse");
+}
+this.sampleMouse=function(e){
+if(!this._rateLimited){
+this.addData("sample",this.trimMouseEvent(e));
+this._rateLimited=true;
+setTimeout(dojo.hitch(this,function(){
+if(this._rateLimited){
+this.trimMouseEvent(this._lastMouseEvent);
+delete this._lastMouseEvent;
+delete this._rateLimited;
+}
+}),this.mouseSampleDelay);
+}
+this._lastMouseEvent=e;
+return e;
+};
+this.trimMouseEvent=function(e){
+var t={};
+for(var i in e){
+switch(i){
+case "target":
+var _5=this.targetProps;
+t[i]={};
+for(var j=0;j<_5.length;j++){
+if(dojo.isObject(e[i])&&_5[j] in e[i]){
+if(_5[j]=="text"||_5[j]=="textContent"){
+if(e[i]["localName"]&&(e[i]["localName"]!="HTML")&&(e[i]["localName"]!="BODY")){
+t[i][_5[j]]=e[i][_5[j]].substr(0,50);
+}
+}else{
+t[i][_5[j]]=e[i][_5[j]];
+}
+}
+}
+break;
+case "x":
+case "y":
+if(e[i]){
+var _7=e[i];
+t[i]=_7+"";
+}
+break;
+default:
+break;
+}
+}
+return t;
+};
+})();
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/mouseOver.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/window.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/window.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/window.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/window.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,36 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.analytics.plugins.window"]){
+dojo._hasResource["dojox.analytics.plugins.window"]=true;
+dojo.provide("dojox.analytics.plugins.window");
+dojox.analytics.plugins.window=new (function(){
+this.addData=dojo.hitch(dojox.analytics,"addData","window");
+this.windowConnects=dojo.config["windowConnects"]||["open","onerror"];
+for(var i=0;i<this.windowConnects.length;i++){
+dojo.connect(window,this.windowConnects[i],dojo.hitch(this,"addData",this.windowConnects[i]));
+}
+dojo.addOnLoad(dojo.hitch(this,function(){
+var _2={};
+for(var i in window){
+if(dojo.isObject(window[i])){
+switch(i){
+case "location":
+case "console":
+_2[i]=window[i];
+break;
+default:
+break;
+}
+}else{
+_2[i]=window[i];
+}
+}
+this.addData(_2);
+}));
+})();
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/plugins/window.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analytics.profile.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analytics.profile.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analytics.profile.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analytics.profile.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,8 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+dependencies={layers:[{name:"../dojox/analytics.js",dependencies:["dojox.analytics","dojox.analytics.plugins.dojo","dojox.analytics.plugins.window","dojox.analytics.plugins.consoleMessages","dojox.analytics.plugins.mouseOver","dojox.analytics.plugins.mouseClick","dojox.analytics.plugins.idle"]}],prefixes:[["dojox","../dojox"],["dijit","../dijit"]]};

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analytics.profile.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analyticsInBase.profile.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analyticsInBase.profile.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analyticsInBase.profile.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analyticsInBase.profile.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,8 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+dependencies={layers:[{name:"dojo.js",dependencies:["dojox.analytics","dojox.analytics.plugins.dojo","dojox.analytics.plugins.window","dojox.analytics.plugins.consoleMessages","dojox.analytics.plugins.mouseOver","dojox.analytics.plugins.mouseClick","dojox.analytics.plugins.idle"]}],prefixes:[["dojox","../dojox"],["dijit","../dijit"]]};

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/analytics/profiles/analyticsInBase.profile.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/README
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/README?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/README (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/README Thu Mar 19 10:37:00 2009
@@ -0,0 +1,53 @@
+-------------------------------------------------------------------------------
+DojoX Data
+-------------------------------------------------------------------------------
+Version 1.0
+Release date: 11/18/2008
+-------------------------------------------------------------------------------
+Project state: experimental
+-------------------------------------------------------------------------------
+Project authors
+	Jared Jurkiewicz (jared.jurkiewicz@gmail.com) 
+	Benjamin Schell (Corporate CLA)
+
+-------------------------------------------------------------------------------
+Project description
+
+The DojoX Atom project is an implementation of the ATOM document format in a 
+JavaScript model and a full Atom Publishing Protocol (APP) io library for working
+with ATOM feeds
+
+-------------------------------------------------------------------------------
+Dependencies:
+
+DojoX Atom has dependencies on core dojo (dojo.data) and the D.O.H. unit test 
+framework.
+-------------------------------------------------------------------------------
+Documentation:
+
+See the Dojo API tool (http://dojotoolkit.org/api)
+as well as dojocampus (http://docs.dojocampus.org/dojox/atom)
+-------------------------------------------------------------------------------
+Contributions:
+
+Constributions of documentation, examples, and fixes are always welcome.
+
+-------------------------------------------------------------------------------
+Installation instructions
+
+Grab the following from the Dojo SVN Repository:
+http://svn.dojotoolkit.org/src/dojo/dojox/trunk/atom/*
+
+Install into the following directory structure:
+/dojox/atom/
+
+...which should be at the same level as your Dojo checkout.
+
+/dojox/atom/*
+
+Require in the sections you wish to use (the model, IO library, etc)
+-------------------------------------------------------------------------------
+Additional Notes: 
+	This library is still undergoing some work and as such the API may change
+	hence the marking of 'experimental'.
+

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/README
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/io/Connection.js
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/io/Connection.js?rev=755904&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/io/Connection.js (added)
+++ camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/io/Connection.js Thu Mar 19 10:37:00 2009
@@ -0,0 +1,267 @@
+/*
+	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
+	Available via Academic Free License >= 2.1 OR the modified BSD license.
+	see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.atom.io.Connection"]){
+dojo._hasResource["dojox.atom.io.Connection"]=true;
+dojo.provide("dojox.atom.io.Connection");
+dojo.require("dojox.atom.io.model");
+dojo.declare("dojox.atom.io.Connection",null,{constructor:function(_1,_2){
+this.sync=_1;
+this.preventCache=_2;
+},preventCache:false,alertsEnabled:false,getFeed:function(_3,_4,_5,_6){
+this._getXmlDoc(_3,"feed",new dojox.atom.io.model.Feed(),dojox.atom.io.model._Constants.ATOM_NS,_4,_5,_6);
+},getService:function(_7,_8,_9,_a){
+this._getXmlDoc(_7,"service",new dojox.atom.io.model.Service(_7),dojox.atom.io.model._Constants.APP_NS,_8,_9,_a);
+},getEntry:function(_b,_c,_d,_e){
+this._getXmlDoc(_b,"entry",new dojox.atom.io.model.Entry(),dojox.atom.io.model._Constants.ATOM_NS,_c,_d,_e);
+},_getXmlDoc:function(_f,_10,_11,_12,_13,_14,_15){
+if(!_15){
+_15=dojo.global;
+}
+var ae=this.alertsEnabled;
+var _17={url:_f,handleAs:"xml",sync:this.sync,preventCache:this.preventCache,load:function(_18,_19){
+var _1a=null;
+var _1b=_18;
+var _1c;
+if(_1b){
+if(typeof (_1b.getElementsByTagNameNS)!="undefined"){
+_1c=_1b.getElementsByTagNameNS(_12,_10);
+if(_1c&&_1c.length>0){
+_1a=_1c.item(0);
+}else{
+if(_1b.lastChild){
+_1a=_1b.lastChild;
+}
+}
+}else{
+if(typeof (_1b.getElementsByTagName)!="undefined"){
+_1c=_1b.getElementsByTagName(_10);
+if(_1c&&_1c.length>0){
+for(var i=0;i<_1c.length;i++){
+if(_1c[i].namespaceURI==_12){
+_1a=_1c[i];
+break;
+}
+}
+}else{
+if(_1b.lastChild){
+_1a=_1b.lastChild;
+}
+}
+}else{
+if(_1b.lastChild){
+_1a=_1b.lastChild;
+}else{
+_13.call(_15,null,null,_19);
+return;
+}
+}
+}
+_11.buildFromDom(_1a);
+if(_13){
+_13.call(_15,_11,_1b,_19);
+}else{
+if(ae){
+var _1e=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_1e.noCallback);
+}
+}
+}else{
+_13.call(_15,null,null,_19);
+}
+}};
+if(this.user&&this.user!==null){
+_17.user=this.user;
+}
+if(this.password&&this.password!==null){
+_17.password=this.password;
+}
+if(_14){
+_17.error=function(_1f,_20){
+_14.call(_15,_1f,_20);
+};
+}else{
+_17.error=function(){
+var _21=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_21.failedXhr);
+};
+}
+dojo.xhrGet(_17);
+},updateEntry:function(_22,_23,_24,_25,_26,_27){
+if(!_27){
+_27=dojo.global;
+}
+_22.updated=new Date();
+var url=_22.getEditHref();
+if(!url){
+var _29=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_29.missingEditUrl);
+}
+var _2a=this;
+var ae=this.alertsEnabled;
+var _2c={url:url,handleAs:"text",contentType:"text/xml",sync:this.sync,preventCache:this.preventCache,load:function(_2d,_2e){
+var _2f=null;
+if(_25){
+_2f=_2e.xhr.getResponseHeader("Location");
+if(!_2f){
+_2f=url;
+}
+var _30=function(_31,dom,_33){
+if(_23){
+_23.call(_27,_31,_2f,_33);
+}else{
+if(ae){
+var _34=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_34.noCallback);
+}
+}
+};
+_2a.getEntry(_2f,_30);
+}else{
+if(_23){
+_23.call(_27,_22,_2e.xhr.getResponseHeader("Location"),_2e);
+}else{
+if(ae){
+var _35=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_35.noCallback);
+}
+}
+}
+return _2d;
+}};
+if(this.user&&this.user!==null){
+_2c.user=this.user;
+}
+if(this.password&&this.password!==null){
+_2c.password=this.password;
+}
+if(_24){
+_2c.error=function(_36,_37){
+_24.call(_27,_36,_37);
+};
+}else{
+_2c.error=function(){
+var _38=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_38.failedXhr);
+};
+}
+if(_26){
+_2c.postData=_22.toString(true);
+_2c.headers={"X-Method-Override":"PUT"};
+dojo.rawXhrPost(_2c);
+}else{
+_2c.putData=_22.toString(true);
+var xhr=dojo.rawXhrPut(_2c);
+}
+},addEntry:function(_3a,url,_3c,_3d,_3e,_3f){
+if(!_3f){
+_3f=dojo.global;
+}
+_3a.published=new Date();
+_3a.updated=new Date();
+var _40=_3a.feedUrl;
+var ae=this.alertsEnabled;
+if(!url&&_40){
+url=_40;
+}
+if(!url){
+if(ae){
+var _42=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_42.missingUrl);
+}
+return;
+}
+var _43=this;
+var _44={url:url,handleAs:"text",contentType:"text/xml",sync:this.sync,preventCache:this.preventCache,postData:_3a.toString(true),load:function(_45,_46){
+var _47=_46.xhr.getResponseHeader("Location");
+if(!_47){
+_47=url;
+}
+if(!_46.retrieveEntry){
+if(_3c){
+_3c.call(_3f,_3a,_47,_46);
+}else{
+if(ae){
+var _48=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_48.noCallback);
+}
+}
+}else{
+var _49=function(_4a,dom,_4c){
+if(_3c){
+_3c.call(_3f,_4a,_47,_4c);
+}else{
+if(ae){
+var _4d=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_4d.noCallback);
+}
+}
+};
+_43.getEntry(_47,_49);
+}
+return _45;
+}};
+if(this.user&&this.user!==null){
+_44.user=this.user;
+}
+if(this.password&&this.password!==null){
+_44.password=this.password;
+}
+if(_3d){
+_44.error=function(_4e,_4f){
+_3d.call(_3f,_4e,_4f);
+};
+}else{
+_44.error=function(){
+var _50=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_50.failedXhr);
+};
+}
+dojo.rawXhrPost(_44);
+},deleteEntry:function(_51,_52,_53,_54,_55){
+if(!_55){
+_55=dojo.global;
+}
+var url=null;
+if(typeof (_51)=="string"){
+url=_51;
+}else{
+url=_51.getEditHref();
+}
+if(!url){
+var _57=dojo.i18n.getLocalization("dojox.atom.io","messages");
+_52.call(_55,false,null);
+throw new Error(_57.missingUrl);
+}
+var _58={url:url,handleAs:"text",sync:this.sync,preventCache:this.preventCache,load:function(_59,_5a){
+_52.call(_55,_5a);
+return _59;
+}};
+if(this.user&&this.user!==null){
+_58.user=this.user;
+}
+if(this.password&&this.password!==null){
+_58.password=this.password;
+}
+if(_53){
+_58.error=function(_5b,_5c){
+_53.call(_55,_5b,_5c);
+};
+}else{
+_58.error=function(){
+var _5d=dojo.i18n.getLocalization("dojox.atom.io","messages");
+throw new Error(_5d.failedXhr);
+};
+}
+if(_54){
+_58.headers={"X-Method-Override":"DELETE"};
+dojo.xhrPost(_58);
+}else{
+dojo.xhrDelete(_58);
+}
+}});
+}

Propchange: camel/trunk/components/camel-web/src/main/webapp/js/dojox/atom/io/Connection.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message