resolving svn conflicts
authorMatt Brown <dowdybrown@yahoo.com>
Thu, 10 Feb 2011 18:48:20 +0000 (18:48 +0000)
committerMatt Brown <dowdybrown@yahoo.com>
Thu, 10 Feb 2011 18:48:20 +0000 (18:48 +0000)
git-svn-id: svn://svn.code.sf.net/p/openrico/code/trunk/rico3@71 53df2df2-7ab5-4331-af62-ea79255fa4e2

ricoClient/js/rico2doj.js [new file with mode: 0644]
ricoClient/js/rico2ext.js [new file with mode: 0644]
ricoClient/js/rico2glo.js [new file with mode: 0644]
ricoClient/js/rico2jqu.js [new file with mode: 0644]
ricoClient/js/rico2moo.js [new file with mode: 0644]
ricoClient/js/rico2pro.js [new file with mode: 0644]

diff --git a/ricoClient/js/rico2doj.js b/ricoClient/js/rico2doj.js
new file mode 100644 (file)
index 0000000..83a92fc
--- /dev/null
@@ -0,0 +1,200 @@
+/**
+  *  Copyright (c) 2009 Matt Brown
+  *
+  *  Licensed 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.
+  **/
+
+if (typeof dojo=='undefined') throw('This version of Rico requires the Dojo library');
+
+Rico.Lib='dojo';
+Rico.LibVersion=dojo.version.toString();
+Rico.extend=dojo.mixin;
+Rico.trim=dojo.trim;
+
+Rico.tryFunctions = function() {
+  for (var i=0; i<arguments.length; i++) {
+               try {
+                       return arguments[i]();
+               } catch(e){}
+       }
+       return null;
+};
+
+Rico.select=dojo.query;
+  
+Rico.eventBind=function(element, eventName, handler) {
+  handler.connection=dojo.connect(Rico.$(element), eventName, handler.object, handler.method);
+};
+
+Rico.eventUnbind=function(element, eventName, handler) {
+  dojo.disconnect(handler.connection);
+};
+
+Rico.eventElement=function(ev) {
+  return ev.target;
+};
+
+Rico.eventStop=dojo.stopEvent;
+
+Rico.eventClient=function(ev) {
+  return {x:ev.pageX, y:ev.pageY};
+};
+
+Rico.eventHandle=function(object, method) {
+  return { object: object, method: method };
+};
+
+Rico.addClass=dojo.addClass;
+Rico.removeClass=dojo.removeClass;
+Rico.hasClass=dojo.hasClass;
+
+Rico.getStyle=function(element, name) {
+  var camelCase = name.replace(/\-(\w)/g, function(all, letter){
+    return letter.toUpperCase();
+  });
+  return dojo.style(element,camelCase);
+};
+
+Rico.setStyle=dojo.style;
+
+// tried to use dojo._abs - 1.3.0 was broken in webkit, nightlies broken on IE8
+Rico.cumulativeOffset=function(element) {
+//  var offset=dojo._abs(element);
+//  return {top:offset.y, left:offset.x};
+  element=Rico.$(element);
+  var valueT = 0, valueL = 0;
+  do {
+    valueT += element.offsetTop  || 0;
+    valueL += element.offsetLeft || 0;
+    element = element.offsetParent;
+  } while (element);
+  return {left: valueL, top: valueT};
+};
+
+Rico.positionedOffset=function(element) {
+  element=Rico.$(element);
+  var p, valueT = 0, valueL = 0;
+  do {
+    valueT += element.offsetTop  || 0;
+    valueL += element.offsetLeft || 0;
+    element = element.offsetParent;
+    if (element) {
+      p = dojo.style(element,'position');
+      if (p == 'relative' || p == 'absolute') break;
+    }
+  } while (element);
+  return {left: valueL, top: valueT};
+};
+
+Rico.getDirectChildrenByTag=function(element, tagName) {
+  var kids = [];
+  var allKids = element.childNodes;
+  tagName=tagName.toLowerCase();
+  for( var i = 0 ; i < allKids.length ; i++ ) {
+    if ( allKids[i] && allKids[i].tagName && allKids[i].tagName.toLowerCase() == tagName )
+      kids.push(allKids[i]);
+  }
+  return kids;
+};
+
+// logic borrowed from Prototype
+Rico._getWinDimension=function(D) {
+  if (this.isWebKit && !document.evaluate) {
+    // Safari <3.0 needs self.innerWidth/Height
+    return self['inner' + D];
+  } else if (this.isOpera && parseFloat(window.opera.version()) < 9.5) {
+    // Opera <9.5 needs document.body.clientWidth/Height
+    return document.body['client' + D]
+  } else {
+    return document.documentElement['client' + D];
+  }
+};
+
+Rico.windowHeight=function() {
+  return this._getWinDimension('Height');
+};
+
+Rico.windowWidth=function() {
+  return this._getWinDimension('Width');
+};
+
+Rico.docScrollLeft=function() {
+  return dojo._docScroll().x;
+};
+
+Rico.docScrollTop=function() {
+  return dojo._docScroll().y;
+};
+
+Rico.ajaxRequest=function(url,options) {
+  this.dojoSend(url,options);
+}
+
+Rico.ajaxRequest.prototype = {
+  dojoSend : function(url,options) {
+    this.onComplete=options.onComplete;
+    this.onSuccess=options.onSuccess;
+    this.onFailure=options.onFailure;
+    var dOptions = {
+      handle : Rico.bind(this,'dojoComplete'),
+      error : Rico.bind(this,'dojoError'),
+      load : Rico.bind(this,'dojoLoad'),
+      url : url,
+      content : options.parameters,
+      form : options.form
+    }
+    var method=options.method.toUpperCase();
+    dojo.xhr(method, dOptions, method=='POST');
+  },
+  
+  dojoComplete : function(dataORerror, ioArgs) {
+    if (this.onComplete) this.onComplete(ioArgs.xhr);
+  },
+  
+  dojoError : function(response, ioArgs) {
+    if (this.onFailure) this.onFailure(ioArgs.xhr);
+  },
+  
+  dojoLoad : function(response, ioArgs) {
+    if (this.onSuccess) this.onSuccess(ioArgs.xhr);
+  }
+}
+
+Rico.getJSON=function(xhr) { return dojo.fromJson(xhr.responseText); };
+
+Rico.ajaxSubmit=function(form,url,options) {
+  options.form=form;
+  if (!options.method) options.method='post';
+  new Rico.ajaxRequest(url,options);
+}
+
+Rico.toQueryString=dojo.objectToQuery;
+
+// Animation
+
+Rico.fadeIn=function(element,duration,onEnd) {
+  var a=dojo.fadeIn({node:element, duration:duration});
+  if (onEnd) dojo.connect(a,"onEnd",onEnd);
+  a.play();
+};
+
+Rico.fadeOut=function(element,duration,onEnd) {
+  var a=dojo.fadeOut({node:element, duration:duration});
+  if (onEnd) dojo.connect(a,"onEnd",onEnd);
+  a.play();
+};
+
+Rico.animate=function(element,options,properties) {
+  options.node=element;
+  options.properties=properties;
+  a=dojo.animateProperty(options);
+  a.play();
+};
diff --git a/ricoClient/js/rico2ext.js b/ricoClient/js/rico2ext.js
new file mode 100644 (file)
index 0000000..dc05a38
--- /dev/null
@@ -0,0 +1,197 @@
+/**
+  *  Copyright (c) 2009 Matt Brown
+  *
+  *  Licensed 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.
+  **/
+
+if (typeof Ext=='undefined') throw('This version of Rico requires the Ext-core library');
+
+
+Rico.Lib='Ext-core';
+Rico.LibVersion=Ext.version;
+Rico.extend=Ext.apply;
+Rico.trim=function(s) { return s.replace(Ext.DomQuery.trimRe,''); };
+Rico.tryFunctions = function() {
+  for (var i=0; i<arguments.length; i++) {
+               try {
+                       return arguments[i]();
+               } catch(e){}
+       }
+       return null;
+};
+
+
+Rico.select=Ext.query;
+  
+Rico.eventBind=function(element, eventName, handler) {
+  Ext.EventManager.addListener(element, eventName, handler.object[handler.method], handler.object);
+};
+
+Rico.eventUnbind=function(element, eventName, handler) {
+  Ext.EventManager.removeListener(element, eventName, handler.object[handler.method], handler.object);
+};
+
+Rico.eventHandle=function(object, method) {
+  return { object: object, method: method };
+};
+
+Rico.eventElement=function(ev) {
+  return ev.target;
+};
+
+Rico.eventClient=function(ev) {
+  return {x:ev.browserEvent.clientX, y:ev.browserEvent.clientY};
+};
+
+Rico.eventStop=function(ev) {
+  ev.stopEvent();
+};
+
+Rico.eventRelatedTarget=function(ev) {
+  return ev.getRelatedTarget();
+};
+  
+Rico.eventKey=function(ev) {
+  return ev.getKey();
+};
+  
+Rico.eventLeftClick=function(ev) {
+  return ev.button===0;
+};
+  
+Rico.addClass=function(element, className) {
+  return Ext.get(element).addClass(className);
+};
+
+Rico.removeClass=function(element, className) {
+  return Ext.get(element).removeClass(className);
+};
+
+Rico.hasClass=function(element, className) {
+  return Ext.get(element).hasClass(className);
+};
+  
+Rico.getStyle=function(element, property) {
+  return Ext.get(element).getStyle(property);
+};
+Rico.setStyle=function(element, properties) {
+  return Ext.get(element).setStyle(properties);
+};
+
+// logic borrowed from Prototype
+// Ext.lib.Dom.getViewportWidth/Height includes scrollbar in Gecko browsers
+Rico._getWinDimension=function(D) {
+  if (this.isWebKit && !document.evaluate) {
+    // Safari <3.0 needs self.innerWidth/Height
+    return self['inner' + D];
+  } else if (this.isOpera && parseFloat(window.opera.version()) < 9.5) {
+    // Opera <9.5 needs document.body.clientWidth/Height
+    return document.body['client' + D]
+  } else {
+    return document.documentElement['client' + D];
+  }
+};
+
+Rico.windowHeight=function() {
+  return this._getWinDimension('Height');
+};
+
+Rico.windowWidth=function() {
+  return this._getWinDimension('Width');
+};
+
+Rico.cumulativeOffset=function(element) {
+  element=Rico.$(element);
+  var valueT = 0, valueL = 0;
+  do {
+    valueT += element.offsetTop  || 0;
+    valueL += element.offsetLeft || 0;
+    element = element.offsetParent;
+  } while (element);
+  return {left: valueL, top: valueT};
+};
+
+Rico.positionedOffset=function(element) {
+  element=Rico.$(element);
+  var p, valueT = 0, valueL = 0;
+  do {
+    valueT += element.offsetTop  || 0;
+    valueL += element.offsetLeft || 0;
+    element = element.offsetParent;
+    if (element) {
+      p = Ext.get(element).getStyle('position');
+      if (p == 'relative' || p == 'absolute') break;
+    }
+  } while (element);
+  return {left: valueL, top: valueT};
+};
+
+Rico.docScrollLeft=function() {
+  return Ext.get(document).getScroll().left;
+};
+
+Rico.docScrollTop=function() {
+  return Ext.get(document).getScroll().top;
+};
+
+Rico.getDirectChildrenByTag=function(element, tagName) {
+  var kids = [];
+  var allKids = element.childNodes;
+  tagName=tagName.toLowerCase();
+  for( var i = 0 ; i < allKids.length ; i++ ) {
+    if ( allKids[i] && allKids[i].tagName && allKids[i].tagName.toLowerCase() == tagName )
+      kids.push(allKids[i]);
+  }
+  return kids;
+};
+
+Rico.ajaxRequest=function(url,options) {
+  var extOptions = {
+    success : options.onSuccess || options.onComplete,
+    failure : options.onFailure || options.onComplete,
+    method : options.method.toUpperCase(),
+    url : url,
+    form : options.form,
+    params : options.parameters
+  }
+  Ext.Ajax.request(extOptions);
+}
+
+Rico.getJSON=function(xhr) { return window["eval"]("(" + xhr.responseText + ")"); };
+
+Rico.ajaxSubmit=function(form,url,options) {
+  options.form=form;
+  if (!options.method) options.method='post';
+  Rico.ajaxRequest(url,options);
+}
+Rico.toQueryString=Ext.urlEncode;
+
+// Animation
+
+Rico.fadeIn=function(element,duration,onEnd) {
+  Ext.get(element).fadeIn({duration:duration/1000.0, callback: onEnd});
+};
+
+Rico.fadeOut=function(element,duration,onEnd) {
+  Ext.get(element).fadeOut({duration:duration/1000.0, callback: onEnd});
+};
+
+Rico.animate=function(element,options,properties) {
+  var opts={};
+  opts.callback=options.onEnd;
+  opts.duration=options.duration/1000.0;
+  opts.width=properties.width;
+  opts.height=properties.height;
+  opts.x=properties.left;
+  opts.y=properties.top;
+  opts.opacity=properties.opacity;
+  Ext.get(element).shift(opts);
+};
diff --git a/ricoClient/js/rico2glo.js b/ricoClient/js/rico2glo.js
new file mode 100644 (file)
index 0000000..e2578d4
--- /dev/null
@@ -0,0 +1,225 @@
+/**
+  *  Copyright (c) 2009 Matt Brown
+  *
+  *  Licensed 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.
+  **/
+
+if (typeof glow=='undefined') throw('This version of Rico requires the glow library');
+
+
+Rico.Lib='Glow';
+Rico.LibVersion=glow.VERSION;
+Rico.extend=glow.lang.apply;
+Rico.trim=glow.lang.trim;
+Rico.tryFunctions = function() {
+  for (var i=0; i<arguments.length; i++) {
+    try {
+      return arguments[i]();
+    } catch(e){}
+  }
+  return null;
+};
+Rico._g=function(element) {
+  if (typeof element=='string')
+    element = document.getElementById(element);
+  return glow.dom.get(element);
+};
+
+Rico.select=function(selector, element) {
+  return element ? this._g(element).get(selector) : glow.dom.get(selector);
+};
+  
+Rico.eventBind=function(element, eventName, handler) {
+  handler.id=glow.events.addListener(Rico.$(element), eventName, handler.object[handler.method], handler.object);
+};
+
+Rico.eventUnbind=function(element, eventName, handler) {
+  glow.events.removeListener(handler.id);
+};
+
+Rico.eventHandle=function(object, method) {
+  return { object: object, method: method };
+};
+
+Rico.eventElement=function(ev) {
+  return ev.source;
+};
+
+Rico.eventClient=function(ev) {
+  return {x:ev.pageX - document.body.scrollLeft - document.documentElement.scrollLeft, 
+          y:ev.pageY - document.body.scrollTop - document.documentElement.scrollTop};
+};
+
+Rico.eventStop=function(ev) {
+  ev.preventDefault();
+  ev.stopPropagation();
+};
+
+Rico.eventKey=function(ev) {
+  return ev.keyCode;
+};
+
+Rico.eventLeftClick=function(ev) {
+  return ev.button==0;
+};
+  
+Rico.addClass=function(element, className) {
+  return this._g(element).addClass(className);
+};
+
+Rico.removeClass=function(element, className) {
+  return this._g(element).removeClass(className);
+};
+
+Rico.hasClass=function(element, className) {
+  return this._g(element).hasClass(className);
+};
+
+/*
+ran into bugs on FF and Safari with native Glow function
+Rico.getStyle=function(element, property) {
+  return this._g(element).css(property);
+};
+
+Use a modified version of Prototype's method
+*/
+Rico.getStyle=function(element, style) {
+  element = Rico.$(element);
+  var camelCase = style.replace(/\-(\w)/g, function(all, letter){
+    return letter.toUpperCase();
+  });
+  style = style == 'float' ? 'cssFloat' : camelCase;
+  var value = element.style[style];
+  if (!value || value == 'auto') {
+    if (element.currentStyle) {
+      value=element.currentStyle[style];
+    } else if (document.defaultView) {
+      var css = document.defaultView.getComputedStyle(element, null);
+      value = css ? css[style] : null;
+    }
+  }
+  if (style == 'opacity') return value ? parseFloat(value) : 1.0;
+  return value == 'auto' ? null : value;
+};
+
+
+Rico.setStyle=function(element, properties) {
+  var elem=this._g(element);
+  for (var prop in properties) {
+    elem.css(prop,properties[prop])
+  }
+};
+
+/**
+ * @returns available height, excluding scrollbar & margin
+ */
+Rico.windowHeight=function() {
+  return glow.dom.get(window).height();
+};
+
+/**
+ * @returns available width, excluding scrollbar & margin
+ */
+Rico.windowWidth=function() {
+  return glow.dom.get(window).width();
+};
+
+Rico.positionedOffset=function(element) {
+  var p, valueT = 0, valueL = 0;
+  do {
+    valueT += element.offsetTop  || 0;
+    valueL += element.offsetLeft || 0;
+    element = element.offsetParent;
+    if (element) {
+      p = glow.dom.get(element).css('position');
+      if (p == 'relative' || p == 'absolute') break;
+    }
+  } while (element);
+  return {left: valueL, top: valueT};
+};
+
+Rico.cumulativeOffset=function(element) {
+  return this._g(element).offset();
+};
+
+Rico._docElement=function() {
+  return (document.compatMode && document.compatMode.indexOf("CSS")!=-1) ? document.documentElement : document.getElementsByTagName("body")[0];
+},
+
+Rico.docScrollLeft=function() {
+  return Rico._docElement.scrollLeft || window.pageXOffset || 0;
+};
+
+Rico.docScrollTop=function() {
+  return Rico._docElement.scrollTop || window.pageYOffset || 0;
+};
+
+Rico.getDirectChildrenByTag=function(element, tagName) {
+  tagName=tagName.toLowerCase();
+  return this._g(element).children().filter(function(i) { return this.tagName && this.tagName.toLowerCase()==tagName; });
+};
+
+Rico.getJSON=function(xhr) { return glow.data.decodeJson(xhr.responseText); };
+
+Rico.ajaxRequest=function(url,options) {
+  this.glowSend(url,options);
+}
+
+Rico.ajaxRequest.prototype = {
+  glowSend : function(url,options) {
+    this.onComplete=options.onComplete;
+    this.onSuccess=options.onSuccess;
+    this.onFailure=options.onFailure;
+    options.onLoad=Rico.bind(this,'glowLoad');
+    options.onError=Rico.bind(this,'glowError');
+    options.useCache=true;
+    if (options.method.toLowerCase()=='post') {
+      glow.net.post(url,options.parameters,options);
+    } else {
+      glow.net.get(url+'?'+glow.data.encodeUrl(options.parameters),options);
+    }
+  },
+  
+  glowError : function(response) {
+    if (this.onFailure) this.onFailure(response);
+    if (this.onComplete) this.onComplete(response.nativeResponse);
+  },
+  
+  glowLoad : function(response) {
+    if (this.onSuccess) this.onSuccess(response.nativeResponse);
+    if (this.onComplete) this.onComplete(response.nativeResponse);
+  }
+}
+
+Rico.ajaxSubmit=function(form,url,options) {
+  options.parameters=glow.data.encodeUrl(this._g(form).val());
+  if (!options.method) options.method='post';
+  url=url || form.action;
+  new Rico.ajaxRequest(url,options);
+}
+Rico.toQueryString=glow.data.encodeUrl;
+
+// Animation
+
+Rico.fadeIn=function(element,duration,onEnd) {
+  glow.anim.fadeIn(this._g(element), duration/1000.0, {onComplete:onEnd});
+};
+
+Rico.fadeOut=function(element,duration,onEnd) {
+  glow.anim.fadeOut(this._g(element), duration/1000.0, {onComplete:onEnd});
+};
+
+Rico.animate=function(element,options,properties) {
+  var effect=glow.anim.css(this._g(element), options.duration/1000.0, properties);
+  glow.events.addListener(effect, "complete", options.onEnd);
+  effect.start();
+  return effect;
+};
diff --git a/ricoClient/js/rico2jqu.js b/ricoClient/js/rico2jqu.js
new file mode 100644 (file)
index 0000000..bc35314
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+  *  Copyright (c) 2009 Matt Brown
+  *
+  *  Licensed 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.
+  **/
+
+if (typeof jQuery=='undefined') throw('This version of Rico requires the jQuery library');
+
+
+Rico.Lib='jQuery';
+Rico.LibVersion=jQuery().jquery;
+Rico.extend=jQuery.extend;
+Rico.trim=jQuery.trim;
+Rico.tryFunctions = function() {
+  for (var i=0; i<arguments.length; i++) {
+               try {
+                       return arguments[i]();
+               } catch(e){}
+       }
+       return null;
+};
+
+
+Rico._j=function(element) {
+  if (typeof element=='string')
+    element = document.getElementById(element);
+  return jQuery(element);
+};
+  
+Rico.select=function(selector, element) {
+  return element ? this._j(element).find(selector) : jQuery(selector);
+};
+  
+Rico.eventBind=function(element, eventName, handler) {
+  this._j(element).bind(eventName, handler);
+};
+
+Rico.eventUnbind=function(element, eventName, handler) {
+  this._j(element).unbind(eventName, handler);
+};
+
+Rico.eventHandle=function(object, method) {
+  return function(e) {
+    return object[method].call(object,e);
+  }
+};
+
+Rico.eventElement=function(ev) {
+  return ev.target;
+};
+
+Rico.eventClient=function(ev) {
+  return {x:ev.clientX, y:ev.clientY};
+};
+
+Rico.eventStop=function(ev) {
+  ev.preventDefault();
+  ev.stopPropagation();
+};
+  
+Rico.addClass=function(element, className) {
+  return this._j(element).addClass(className);
+};
+
+Rico.removeClass=function(element, className) {
+  return this._j(element).removeClass(className);
+};
+
+Rico.hasClass=function(element, className) {
+  return this._j(element).hasClass(className);
+};
+  
+Rico.getStyle=function(element, property) {
+  return this._j(element).css(property);
+};
+Rico.setStyle=function(element, properties) {
+  return this._j(element).css(properties);
+};
+
+/**
+ * @returns available height, excluding scrollbar & margin
+ */
+Rico.windowHeight=function() {
+  return jQuery(window).height();
+};
+
+/**
+ * @returns available width, excluding scrollbar & margin
+ */
+Rico.windowWidth=function() {
+  return jQuery(window).width();
+};
+
+Rico.positionedOffset=function(element) {
+  return this._j(element).position();
+};
+
+Rico.cumulativeOffset=function(element) {
+  return this._j(element).offset();
+};
+
+Rico.docScrollLeft=function() {
+  return jQuery('html').scrollLeft();
+};
+
+Rico.docScrollTop=function() {
+  return jQuery('html').scrollTop();
+};
+
+Rico.getDirectChildrenByTag=function(element, tagName) {
+  return this._j(element).children(tagName);
+};
+
+Rico.ajaxRequest=function(url,options) {
+  this.jSend(url,options);
+}
+
+Rico.ajaxRequest.prototype = {
+  jSend: function(url,options) {
+    this.onSuccess=options.onSuccess;
+    var jOptions = {
+      complete : options.onComplete,
+      error: options.onFailure,
+      success: Rico.bind(this,'jSuccess'),
+      type : options.method.toUpperCase(),
+      url : url,
+      data : options.parameters
+    }
+    this.xhr=jQuery.ajax(jOptions);
+  },
+  
+  jSuccess: function() {
+    if (this.onSuccess) this.onSuccess(this.xhr);
+  }
+}
+
+Rico.getJSON=function(xhr) { return jQuery.httpData(xhr,'json'); };
+
+Rico.ajaxSubmit=function(form,url,options) {
+  options.parameters=this._j(form).serialize();
+  if (!options.method) options.method='post';
+  url=url || form.action;
+  new Rico.ajaxRequest(url,options);
+}
+Rico.toQueryString=jQuery.param;
+
+// Animation
+
+Rico.fadeIn=function(element,duration,onEnd) {
+  this._j(element).fadeIn(duration,onEnd);
+};
+
+Rico.fadeOut=function(element,duration,onEnd) {
+  this._j(element).fadeOut(duration,onEnd);
+};
+
+Rico.animate=function(element,options,properties) {
+  options.complete=options.onEnd;
+  this._j(element).animate(properties,options);
+};
diff --git a/ricoClient/js/rico2moo.js b/ricoClient/js/rico2moo.js
new file mode 100644 (file)
index 0000000..ebaeb6f
--- /dev/null
@@ -0,0 +1,184 @@
+/**
+  *  Copyright (c) 2009, 2010 Matt Brown
+  *
+  *  Licensed 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.
+  **/
+
+if (typeof MooTools=='undefined') throw('This version of Rico requires the MooTools library');
+
+
+Rico.Lib='MooTools';
+Rico.LibVersion=MooTools.version;
+Rico.extend=typeof($extend) != 'undefined' ? $extend : Object.append;
+Rico.tryFunctions = typeof($try) != 'undefined' ? $try : Function.attempt;
+Rico.trim=function(s) { return s.trim(); };
+
+Rico.select=function(selector, element) {
+  return $(element || document).getElements(selector);
+};
+  
+Rico.eventBind=function(element, eventName, handler) {
+  $(element).addEvent(eventName, handler);
+};
+
+Rico.eventUnbind=function(element, eventName, handler) {
+  $(element).removeEvent(eventName, handler);
+};
+
+Rico.eventHandle=function(object, method) {
+  return function(e) { object[method].call(object,e); };
+};
+
+Rico.eventElement=function(ev) {
+  return ev.target;
+};
+
+Rico.eventClient=function(ev) {
+  return ev.client;
+};
+
+Rico.eventKey=function(ev) {
+  return ev.code;
+};
+
+Rico.eventStop=function(ev) {
+  ev.stop();
+};
+
+Rico.eventLeftClick=function(ev) {
+  return !ev.rightClick;
+};
+  
+Rico.addClass=function(element, className) {
+  return $(element).addClass(className);
+};
+
+Rico.removeClass=function(element, className) {
+  return $(element).removeClass(className);
+};
+
+Rico.hasClass=function(element, className) {
+  return $(element).hasClass(className);
+};
+  
+Rico.getStyle=function(element, property) {
+  return $(element).getStyle(property);
+};
+
+Rico.setStyle=function(element, properties) {
+  return $(element).setStyles(properties);
+};
+
+/**
+ * @returns available height, excluding scrollbar & margin
+ */
+Rico.windowHeight=function() {
+  return Window.getSize().y;
+};
+
+/**
+ * @returns available width, excluding scrollbar & margin
+ */
+Rico.windowWidth=function() {
+  return Window.getSize().x;
+};
+
+Rico._fixOffsets=function(o) {
+  return {top: o.y, left: o.x};
+}
+
+Rico.positionedOffset=function(element) {
+  var p, valueT = 0, valueL = 0;
+  do {
+    valueT += element.offsetTop  || 0;
+    valueL += element.offsetLeft || 0;
+    element = element.offsetParent;
+    if (element) {
+      p = $(element).getStyle('position');
+      if (p == 'relative' || p == 'absolute') break;
+    }
+  } while (element);
+  return {left: valueL, top: valueT};
+};
+
+Rico.cumulativeOffset=function(element) {
+  return this._fixOffsets($(element).getPosition());
+};
+
+Rico.docScrollLeft=function() {
+  return Window.getScroll().x;
+};
+
+Rico.docScrollTop=function() {
+  return Window.getScroll().y;
+};
+
+Rico.getDirectChildrenByTag=function(element, tagName) {
+  return $(element).getChildren(tagName);
+};
+
+Rico.ajaxRequest=function(url,options) {
+  this.mooSend(url,options);
+}
+
+Rico.ajaxRequest.prototype = {
+  mooSend : function(url,options) {
+    this.onSuccess=options.onSuccess;
+    this.onComplete=options.onComplete;
+    var mooOptions = {
+      onComplete : Rico.bind(this,'mooComplete'),
+      onSuccess : Rico.bind(this,'mooSuccess'),
+      onFailure : options.onFailure,
+      method : options.method,
+      data : options.parameters,
+      url : url
+    }
+    this.mooRequest = new Request(mooOptions);
+    this.mooRequest.send();
+  },
+  
+  mooSuccess : function() {
+    if (this.onSuccess) this.onSuccess(this.mooRequest.xhr);
+  },
+  
+  mooComplete : function() {
+    if (this.onComplete) this.onComplete(this.mooRequest.xhr);
+  }
+}
+
+Rico.getJSON=function(xhr) { return JSON.decode(xhr.responseText,true); };
+
+Rico.ajaxSubmit=function(form,url,options) {
+  options.parameters=$(form).toQueryString();
+  if (!options.method) options.method='post';
+  url=url || form.action;
+  new Rico.ajaxRequest(url,options);
+}
+Rico.toQueryString=typeof(Hash) != 'undefined' ? Hash.toQueryString : Object.toQueryString;
+
+// Animation
+
+Rico.fadeIn=function(element,duration,onEnd) {
+  var a = new Fx.Tween(element, {duration:duration, onComplete:onEnd});
+  a.start('opacity', 1);
+};
+
+Rico.fadeOut=function(element,duration,onEnd) {
+  var a = new Fx.Tween(element, {duration:duration, onComplete:onEnd});
+  a.start('opacity', 0);
+};
+
+Rico.animate=function(element,options,properties) {
+  options.onComplete=options.onEnd;
+  var effect=new Fx.Morph(element,options);
+  effect.start(properties);
+  return effect;
+};
diff --git a/ricoClient/js/rico2pro.js b/ricoClient/js/rico2pro.js
new file mode 100644 (file)
index 0000000..bf90dba
--- /dev/null
@@ -0,0 +1,146 @@
+/**
+  *  Copyright (c) 2009 Matt Brown
+  *
+  *  Licensed 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.
+  **/
+
+if (typeof Prototype=='undefined') throw('This version of Rico requires the Prototype library');
+
+Rico.Lib='Prototype';
+Rico.LibVersion=Prototype.Version;
+Rico.extend=Object.extend;
+Rico.tryFunctions=Try.these;
+Rico.trim=function(s) { return s.strip(); };
+
+Rico.toQueryString=Object.toQueryString;
+Rico.ajaxRequest=Ajax.Request;
+
+Rico.ajaxSubmit=function(form,url,options) {
+  options.parameters=Form.serialize(form);
+  if (!options.method) options.method='post';
+  url=url || form.action;
+  new Ajax.Request(url,options);
+}
+
+Rico.getJSON=function(xhr) { return xhr.responseJSON; };
+
+Rico.select=function(selector, element) {
+  return element ? $(element).select(selector) : $$(selector);
+};
+  
+Rico.eventBind=Event.observe;
+Rico.eventUnbind=Event.stopObserving;
+Rico.eventElement=Event.element;
+Rico.eventStop=Event.stop;
+Rico.eventClient=function(ev) {
+  return {x:ev.clientX, y:ev.clientY};
+};
+
+Rico.eventHandle=function(object, method) {
+  return object[method].bindAsEventListener(object);
+};
+
+Rico.addClass=Element.addClassName;
+Rico.removeClass=Element.removeClassName;
+Rico.hasClass=Element.hasClassName;
+
+Rico.getStyle=Element.getStyle;
+Rico.setStyle=Element.setStyle;
+Rico.windowHeight=function() {
+  return document.viewport.getHeight();
+};
+Rico.windowWidth=function() {
+  return document.viewport.getWidth();
+};
+Rico.positionedOffset=function(element) {
+  return $(element).positionedOffset();
+};
+Rico.cumulativeOffset=function(element) {
+  return $(element).cumulativeOffset();
+};
+
+Rico.docScrollLeft=function() {
+  return document.viewport.getScrollOffsets().left;
+};
+
+Rico.docScrollTop=function() {
+  return document.viewport.getScrollOffsets().top;
+};
+
+Rico.getDirectChildrenByTag=function(element, tagName) {
+  tagName=tagName.toLowerCase();
+  return $(element).childElements().inject([],function(result,child) {
+    if (child.tagName && child.tagName.toLowerCase()==tagName) result.push(child);
+    return result;});
+};
+
+
+// Animation
+
+Rico._animate=Class.create({
+  initialize: function(element,options,properties) {
+    this.element=$(element);
+    this.properties=[];
+    this.totSteps=(typeof options.duration =='number' ? options.duration : 500)/25;
+    this.options=options;
+    this.curStep=0;
+    var m,curval;
+    for (var p in properties) {
+      curval=this.element.getStyle(p);
+      switch (typeof curval) {
+        case 'string':
+          if (m=curval.match(/(-?\d+\.?\d*)([a-zA-Z]*)$/)) {
+            this.properties.push({property:p, vStart:parseFloat(m[1]), vEnd:parseFloat(properties[p]), units:m.length > 2 ? m[2] : ''});
+          }
+          break;
+        case 'number':
+          this.properties.push({property:p, vStart:curval, vEnd:parseFloat(properties[p]), units:''});
+          break;
+      }
+    }
+    this.px=new PeriodicalExecuter(this.processStep.bind(this),0.025);
+  },
+  
+  processStep: function() {
+    this.curStep++;
+    if (this.curStep >= this.totSteps) {
+      this.px.stop();
+      for (var i=0; i<this.properties.length; i++) {
+        this.setStyle(i,this.properties[i].vEnd);
+      }
+      if (this.options.onEnd) this.options.onEnd();
+    } else {
+      for (var i=0; i<this.properties.length; i++) {
+        var n=this.properties[i].vStart + (this.curStep / this.totSteps) * (this.properties[i].vEnd - this.properties[i].vStart);
+        this.setStyle(i,n);
+      }
+    }
+  },
+  
+  setStyle: function(idx, newVal) {
+    if (this.properties[idx].units) newVal+=this.properties[idx].units;
+    var styleParm={};
+    styleParm[this.properties[idx].property]=newVal;
+    this.element.setStyle(styleParm);
+  }
+});
+
+Rico.animate=function(element,options,properties) {
+  var a=new Rico._animate(element,options,properties);
+};
+
+Rico.fadeIn=function(element,duration,onEnd) {
+  new Rico._animate(element, {duration:duration, onEnd:onEnd}, {opacity:1.0})
+};
+
+Rico.fadeOut=function(element,duration,onEnd) {
+  new Rico._animate(element, {duration:duration, onEnd:onEnd}, {opacity:0.0})
+};