From xap-commits-returnwford@example.com Sat Sep 08 20:43:05 2007 Return-Path: <xap-commits-returnwford@example.com> Delivered-To: wford@example.com Received: (qmail 85543 invoked from network); 8 Sep 2007 20:43:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 8 Sep 2007 20:43:05 -0000 Received: (qmail 7452 invoked by uid 500); 8 Sep 2007 20:42:59 -0000 Delivered-To: wford@example.com Received: (qmail 7433 invoked by uid 500); 8 Sep 2007 20:42:58 -0000 Mailing-List: contact wford@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:wford@example.com> List-Unsubscribe: <mailto:wford@example.com> List-Post: <mailto:wford@example.com> List-Id: <xap-commits.incubator.apache.org> Reply-To: wford@example.com Delivered-To: mailing list wford@example.com Received: (qmail 7424 invoked by uid 99); 8 Sep 2007 20:42:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Sep 2007 13:42:58 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Sep 2007 20:44:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2D5E81A9832; Sat, 8 Sep 2007 13:42:42 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r573905 - /incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js Date: Sat, 08 Sep 2007 20:42:41 -0000 To: wford@example.com From: wford@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <wford@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: jmargaris Date: Sat Sep 8 13:42:41 2007 New Revision: 573905 URL: http://svn.apache.org/viewvc?rev=573905&view=rev Log: make 'this' work with non-objects like strngs Modified: incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js Modified: incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js?rev=573905&r1=573904&r2=573905&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js (original) +++ incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js Sat Sep 8 13:42:41 2007 @@ -76,6 +76,10 @@ * do something like 'this.employees' not just 'employees' */ xap.data.datasource.ObjectDataSource.prototype.evalOnObject = function( evalText, object){ + //if the text is just "this" return, this will work with strings + if (text=='this'){ + return object; + } if (!object._eval){ object._eval = function( text ){ return eval(text); From xap-commits-returnwford@example.com Sun Sep 09 02:00:57 2007 Return-Path: <xap-commits-returnwford@example.com> Delivered-To: wford@example.com Received: (qmail 64376 invoked from network); 9 Sep 2007 02:00:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 9 Sep 2007 02:00:56 -0000 Received: (qmail 8412 invoked by uid 500); 9 Sep 2007 02:00:50 -0000 Delivered-To: wford@example.com Received: (qmail 8396 invoked by uid 500); 9 Sep 2007 02:00:50 -0000 Mailing-List: contact wford@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:wford@example.com> List-Unsubscribe: <mailto:wford@example.com> List-Post: <mailto:wford@example.com> List-Id: <xap-commits.incubator.apache.org> Reply-To: wford@example.com Delivered-To: mailing list wford@example.com Received: (qmail 8387 invoked by uid 99); 9 Sep 2007 02:00:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Sep 2007 19:00:50 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Sep 2007 02:00:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8574F1A9832; Sat, 8 Sep 2007 19:00:35 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r573942 - in /incubator/xap/trunk/codebase/src/xap: bridges/xap/ListBoxBridge.js bridges/xap/ListItemBridge.js bridges/xap/XapComboBoxBridge.js widgets/ListBox.js widgets/ListItem.js widgets/XapComboBox.js Date: Sun, 09 Sep 2007 02:00:34 -0000 To: wford@example.com From: wford@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <wford@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: jmargaris Date: Sat Sep 8 19:00:33 2007 New Revision: 573942 URL: http://svn.apache.org/viewvc?rev=573942&view=rev Log: made things a lot simpler, should work better and more consistently in IE Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js incubator/xap/trunk/codebase/src/xap/widgets/ListBox.js incubator/xap/trunk/codebase/src/xap/widgets/ListItem.js incubator/xap/trunk/codebase/src/xap/widgets/XapComboBox.js Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js?rev=573942&r1=573941&r2=573942&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js (original) +++ incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js Sat Sep 8 19:00:33 2007 @@ -95,17 +95,9 @@ var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession()); clientEvent.originalEvent = event ; - clientEvent.value = valtext.value ; ; + clientEvent.value = valtext.value ; clientEvent.text = valtext.text ; this.fireEvent("onStateChange",null,null,clientEvent); - - //combo boxes tend to have dsipaly problems: - if( this.isChildOfComboBox ){ - // true == "force focus back here", - // which is all right in this case - this.getPeer().refreshSelectBox(true) ; - } - } @@ -124,7 +116,7 @@ var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession()); clientEvent.originalEvent = event ; - clientEvent.value = optionItem.value ; ; + clientEvent.value = optionItem.value ; clientEvent.text = optionItem.text ; this.fireEvent("onSelect",null,null,clientEvent); @@ -142,35 +134,8 @@ var elementListItem = childHandler.getElement(); var childPeer = childHandler.getPeer(); - childPeer.setDetail(elementListItem.getAttribute('text'), elementListItem.getAttribute('value')); - - var peer = this.getPeer() ; peer.addChild(childPeer); - if( !peer.trueSize ){ - peer.trueSize = 0 ; - } - ++peer.trueSize ; - - if(this.isChildOfComboBox){ - // ComboBox "size" is always 1, so list isn't displayed - // until we might want it to be: - peer.size = 1 ; - } else { - // ListBox "size" is always at least 2, so the - // list is always displayed---though not necesarily all at - // once: it might be scrolled if item-height*size > list-height: - if( peer.trueSize>1){ - var cacheHeight = peer.select.height ; - peer.select.size = peer.trueSize ; - peer.select.height = cacheHeight ; - } - - } - - - - } // Adjust world to changes from adding a new option list item: @@ -181,29 +146,15 @@ this.revalue() ; } +xap.bridges.xap.ListBoxBridge.prototype.setIsChildOfComboBox = function( b ){ + this.isChildOfComboBox = b; + this.getPeer().setIsCombobox(b); + +} xap.bridges.xap.ListBoxBridge.prototype.removeChild = function( childHandler ){ var peer = this.getPeer() ; peer.removeChild(childHandler.getPeer()); - --peer.trueSize ; - // See addChild() above: - if(this.isChildOfComboBox){ - // ComboBox "size" is always 1, so list isn't displayed - // until top is clicked - peer.size = 1 ; - - } else { - // ListBox "size" is always at least 2, so the - // list is always displayed---though not necesarily all at - // once: it might be scrolled if item-height*size > list-height: - if( peer.trueSize>1){ - var cacheHeight = peer.select.height ; - peer.select.size = peer.trueSize ; - peer.select.height = cacheHeight ; - } - - } - } @@ -224,29 +175,6 @@ } } -xap.bridges.xap.ListBoxBridge.prototype.setColorAttribute = function(value){ - this.getPeer().setColor( value ) ; -} -xap.bridges.xap.ListBoxBridge.prototype.setFontFamilyAttribute = function(value){ - this.getPeer().setFontFamily( value ) ; -} -xap.bridges.xap.ListBoxBridge.prototype.setFontSizeAttribute = function(value){ - this.getPeer().setFontSize( value ) ; -} -xap.bridges.xap.ListBoxBridge.prototype.setFontStyleAttribute = function(value){ - this.getPeer().setFontStyle( value ) ; -} -xap.bridges.xap.ListBoxBridge.prototype.setFontWeightAttribute = function(value){ - this.getPeer().setFontWeight( value ) ; -} - -xap.bridges.xap.ListBoxBridge.prototype.setXAttribute = function(value) { - this.getPeer().setX( value ) ; -} -xap.bridges.xap.ListBoxBridge.prototype.setYAttribute = function(value) { - this.getPeer().setY( value ) ; -} - xap.bridges.xap.ListBoxBridge.prototype.setDisabledAttribute = function(pszDisabled) { xap.bridges.basic.AbstractWidgetBridge.prototype.setDisabledAttribute.call(this,pszDisabled); // Default is "enabled": @@ -257,9 +185,6 @@ this.getPeer().setDisabled(bDisabled); } -xap.bridges.xap.ListBoxBridge.prototype.setVisibleAttribute = function(pszVisible) { - this.getPeer().setVisible(pszVisible); -} xap.bridges.xap.ListBoxBridge.prototype.onMouseDown = function(event){ xap.bridges.dojo.DojoWidgetBridge.prototype.onMouseDown.call(this,event) ; Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js?rev=573942&r1=573941&r2=573942&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js (original) +++ incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js Sat Sep 8 19:00:33 2007 @@ -33,14 +33,20 @@ xap.bridges.xap.ListItemBridge.prototype.getNewAllowedAttributes = function(){ - return ['selected']; + return ['selected', 'text', 'value']; } xap.bridges.xap.ListItemBridge.prototype.setSelectedAttribute = function(value) { - if (value == 'true') { - this.getPeer().setSelected(); - } + this.getPeer().setSelected(value=='true'?true:false); +} + +xap.bridges.xap.ListItemBridge.prototype.setTextAttribute = function(value) { + this.getPeer().domNode.text = value; +} + +xap.bridges.xap.ListItemBridge.prototype.setValueAttribute = function(value) { + this.getPeer().domNode.value = value; } xap.bridges.xap.ListItemBridge.prototype.onChange = function(event){ Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js?rev=573942&r1=573941&r2=573942&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js (original) +++ incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js Sat Sep 8 19:00:33 2007 @@ -39,11 +39,7 @@ xap.bridges.xap.XapComboBoxBridge.prototype.getPeerString = function(){ return "XapComboBox" ; } -// -//xap.bridges.xap.XapComboBoxBridge.prototype.getPeerOnCommandEvent = function(){ -// return "onSelect" ; -//} -// + xap.bridges.xap.XapComboBoxBridge.prototype.init = function(){ // Keep us from firing events first off: var initialDisabledState = this._disabled ; @@ -63,13 +59,14 @@ * Doesn't really work for dropdown boxes.... **/ xap.bridges.xap.XapComboBoxBridge.prototype.setHeightAttribute = function(value) { - xap.bridges.dojo.DojoWidgetBridge.prototype.setHeightAttribute.call(this,value); - this.getPeer().setHeight( value ) ; + //doesn't work in IE at all so forget about it?? } xap.bridges.xap.XapComboBoxBridge.prototype.setWidthAttribute = function(value) { xap.bridges.dojo.DojoWidgetBridge.prototype.setWidthAttribute.call(this,value); - this.getPeer().setWidth(value) ; + if (this._childHandler){ + this._childHandler.getRootDomNode().style.width="100%"; + } } xap.bridges.xap.XapComboBoxBridge.prototype.addChild = function(childHandler) { @@ -85,7 +82,7 @@ dojo.event.disconnect(this._childHandler,"removeChild",this,"listboxAddedOrRemovedChild") ; } - childHandler.isChildOfComboBox = true; + childHandler.setIsChildOfComboBox(true); var element = childHandler.getElement(); /*listBox*/ @@ -94,36 +91,7 @@ this._childListbox = childHandler.getPeer(); this._childHandler = childHandler ; - // make this a dropdown: - this._childListbox.select.multiple = null; - this._childListbox.select.removeAttribute('multiple'); - this._childListbox.select.size = 1 ; - - this._childListbox.trimSuperUnarySelectedOptions() - - this.getPeer().addChild(this._childListbox); - - - // Make select box assume its natural width: - this._childListbox.refreshSelectBox() - // Now reset it to something else, if th - // tag attributes so demand: - this.resetBoxFromElement() ; - - - - // Fixes height not right on initial display bug in Firefox: - //---can't do anything about IE heights: - var desiredHeight = this.getElement().getAttribute("height") ; - if( desiredHeight ){ - this.setHeightAttribute("1px") ; - this.setHeightAttribute(this.getElement().getAttribute("height")) ; - this._childListbox.select.style.height = "100%" ; - } - - - // Notice events in the child: dojo.event.connect(this._childHandler,"onChange",this,"onChange") ; @@ -136,51 +104,6 @@ } - - -xap.bridges.xap.XapComboBoxBridge.prototype.resetBoxFromElement = function(){ - if( !this._childHandler ){ - return ; - } - var desiredLBHeight = this._childHandler.getElement().getAttribute("height"); - var desiredCBHeight = this.getElement().getAttribute("height") ; - // For the case when there's a listbox height but no combobbox height: - var desiredHeight = desiredLBHeight ; - if( desiredCBHeight ){ - desiredHeight = desiredCBHeight ; - } - // If there's an explicit height: - if( desiredHeight ){ - // Fixes height not right on initial display bug in Firefox: - //---can't do anything about IE heights: - this.setHeightAttribute("1px") ; - this.setHeightAttribute( desiredHeight ) ; - this._childListbox.select.style.height = desiredHeight ; - - this.getElement().setAttribute("height",desiredHeight) ; - - } - - var desiredLBWidth = this._childHandler.getElement().getAttribute("width"); - var desiredCBWidth = this.getElement().getAttribute("width") ; - // For the case when there's a listbox width but no combobox width: - var desiredWidth = desiredLBWidth ; - if( desiredCBWidth ){ - desiredWidth = desiredCBWidth ; - } - - // If there's an explicit width: - if( desiredWidth){ - this.getRootDomNode().style.width = desiredWidth ; - this._childListbox.select.style.width = desiredWidth ; - - this._childHandler.getElement().setAttribute("width",desiredWidth) ; - this.getElement().setAttribute("width",desiredWidth) ; - - } -} - - xap.bridges.xap.XapComboBoxBridge.prototype.listboxAddedOrRemovedChild = function(anEvent){ // These should be two strings, since the child // should be a single-valued list box. @@ -238,58 +161,57 @@ } +//attributes on combobox that have to filter to the underlying select listbox -xap.bridges.xap.XapComboBoxBridge.prototype.setColorAttribute = function(value){ - this.getPeer().setColor( value ) ; -} - xap.bridges.xap.XapComboBoxBridge.prototype.setBackgroundColorAttribute = function(value){ - this.getPeer().setBackgroundColor( value ) ; -} -xap.bridges.xap.XapComboBoxBridge.prototype.setBorderColorAttribute = function(value){ - this.getPeer().setBorderColor( value ) ; -} -xap.bridges.xap.XapComboBoxBridge.prototype.setBorderStyleAttribute = function(value){ - this.getPeer().setBorderStyle( value ) ; -} -xap.bridges.xap.XapComboBoxBridge.prototype.setBorderWidthAttribute = function(value){ - this.getPeer().setBorderWidth( value ) ; - // Changing border widths can change box unpleasantly: - this.resetBoxFromElement() ; -} - -xap.bridges.xap.XapComboBoxBridge.prototype.setXAttribute = function(value){ - this.getPeer().setX( value ) ; -} -xap.bridges.xap.XapComboBoxBridge.prototype.setYAttribute = function(value){ - this.getPeer().setY( value ) ; -} - -xap.bridges.xap.XapComboBoxBridge.prototype.setVisibleAttribute = function(pszVisible) { - this.getPeer().setVisible(pszVisible); + xap.bridges.dojo.DojoWidgetBridge.prototype.setBackgroundColorAttribute.call(this,value) ; + if (this._childHandler){ + this._childHandler.setBackgroundColorAttribute(value) ; + } } -xap.bridges.xap.XapComboBoxBridge.prototype.setFontColorAttribute = function(value) { - this.getPeer().setFontColor( value ) ; +xap.bridges.xap.XapComboBoxBridge.prototype.setColorAttribute = function(value) { + xap.bridges.dojo.DojoWidgetBridge.prototype.setColorAttribute.call(this,value) ; + if (this._childHandler){ + this._childHandler.setColorAttribute(value) ; + } } xap.bridges.xap.XapComboBoxBridge.prototype.setFontFamilyAttribute = function(value) { - this.getPeer().setFontFamily( value ) ; + xap.bridges.dojo.DojoWidgetBridge.prototype.setFontFamilyAttribute.call(this,value) ; + if (this._childHandler){ + this._childHandler.setFontFamilyAttribute(value) ; + } } xap.bridges.xap.XapComboBoxBridge.prototype.setFontSizeAttribute = function(value) { - this.getPeer().setFontSize( value ) ; + xap.bridges.dojo.DojoWidgetBridge.prototype.setFontSizeAttribute.call(this,value) ; + if (this._childHandler){ + this._childHandler.setFontSizeAttribute(value) ; + } } xap.bridges.xap.XapComboBoxBridge.prototype.setFontStyleAttribute = function(value) { - this.getPeer().setFontStyle( value ) ; -} -xap.bridges.xap.XapComboBoxBridge.prototype.setFontWeightAttribute = function(value) { - this.getPeer().setFontWeight( value ) ; + xap.bridges.dojo.DojoWidgetBridge.prototype.setFontStyleAttribute.call(this,value) ; + if (this._childHandler){ + this._childHandler.setFontStyleAttribute(value) ; + } } +xap.bridges.xap.XapComboBoxBridge.prototype.setTextDecorationAttribute = function(value) { + xap.bridges.dojo.DojoWidgetBridge.prototype.setTextDecorationAttribute.call(this,value) ; + if (this._childHandler){ + this._childHandler.setTextDecorationAttribute(value) ; + } +} +xap.bridges.xap.XapComboBoxBridge.prototype.setFontWeightAttribute = function(value) { + xap.bridges.dojo.DojoWidgetBridge.prototype.setFontWeightAttribute.call(this,value) ; + if (this._childHandler){ + this._childHandler.setFontWeightAttribute(value) ; + } +} xap.bridges.xap.XapComboBoxBridge.prototype.setDisabledAttribute = function(pszValue){ - xap.bridges.basic.AbstractWidgetBridge.prototype.setDisabledAttribute(this,pszValue) ; + xap.bridges.dojo.DojoWidgetBridge.prototype.setDisabledAttribute.call(this,pszValue) ; if (this._childHandler){ this._childHandler.setDisabledAttribute(pszValue) ; } Modified: incubator/xap/trunk/codebase/src/xap/widgets/ListBox.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/ListBox.js?rev=573942&r1=573941&r2=573942&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/widgets/ListBox.js (original) +++ incubator/xap/trunk/codebase/src/xap/widgets/ListBox.js Sat Sep 8 19:00:33 2007 @@ -49,13 +49,24 @@ templateCssPath: null, widgetType: "ListBox", isContainer: true, + + setIsCombobox: function(b){ + //if true make sure the select size is always one, otherwise + //make sure it is less than one always + this.isCombobox = b; + this.select.size = 1; + this.setSelectMultiple(false); + }, setSelectMultiple:function(tf){ + if (this.select.multiple==tf){ + return; + } this.multiselect = tf ; if(tf){ this.select.multiple = true ; } else { - this.select.removeAttribute('multiple'); + this.select.multiple = false; // If more than one is selected at this point, // keep the first (faute de mieux) and deselect // the rest: @@ -64,101 +75,29 @@ }, addChild:function(child){ - // No problem with losing old selections - // under Mozilla, no problem anywhere if - // multiple selection is off, since losing the - // old selections is exactly what is desired there... - if( navigator.appVersion.indexOf("MSIE 6") > -1 ){ - this.raw_addChild(child) ; - return ; - } - - if( !this.preAddedItems ){ - this.preAddedItems= new Array(0) ; + var select = this.select ; + this.select.options[this.select.options.length] = child.domNode; + if (this.isCombobox){ + } - this.preAddedItems.push(child) ; - dojo.lang.setTimeout(this,"addChildrenFromPrelist",0) ; - }, - addChildrenFromPrelist:function(){ - // assert typeof window.netscape != "undefined" ; - if( this.preAddedItems && this.preAddedItems.length > 0 ){ - // The shift() removes the first element in the list - // and returns it; it and the length test above are - // the essence of this recursive add(), which we're doing - // so we can cater to IE's display oddness with a minimal - // delay: - this.raw_addChild(this.preAddedItems.shift()) ; - dojo.lang.setTimeout(this,"addChildrenFromPrelist",0) ; - } else { - // We're done adding options; force a redisplay: - this.refreshSelectBox() ; + else{ + this.select.size = this.select.options.length; } + }, - raw_addChild: function(child) { /* elementListItem */ - var select =this.select ; - select.appendChild(child.domNode); - - //alert('adding an option'); - if( this.multiselect){ - ++select.size ; - } - this.onStructureChange() ; - }, removeChild: function(child) { - - //this.select.removeChild(child.domNode); - var options = this.select.options - + var options = this.select.options; for (var i = 0; i < options.length; i++) { if (options[i] == child.domNode){ - - options[i] = null; - } - /* IE doesn't update the page with dom node removal so we have to do this*/ - - } - --this.select.size ; - this.onStructureChange() ; - }, - - maxHeight:function(){ - // Find the max height of the select box - var node = this.domNode ; - var height = 0 ; - var optionNode = node.firstChild ; - while( optionNode ){ - height = optionNode.clientHeight ; - optionNode = optionNode.nextSibling ; - } - return height ; - }, - - firstOptionHeight:function(){ - // Find the height of the top part of the select box - // or the select node itself, or the intended height of the first option: - var node = this.domNode ; - var height = node.clientHeight ; - var optionNode = node.firstChild ; - if( optionNode ){ - height = optionNode.clientHeight ; - // The option might invisible, in which case it - // doesn't have a clientHeight, but it might have a style promising - // it's future height: - var heightString = optionNode.style.height.replace(/px/,"") ; - if( heightString.match(/^ *[0-9]+ *$/)){ - var styleHeight = parseInt(heightString ) ; - if( styleHeight != "NaN" ){ - height = Math.max( height, styleHeight ) ; + if (this.isCombobox){ + + }else{ + this.select.size = 2>this.select.options.length?2:this.select.options.length; } } - } - return height ; - }, - - numberOfOptions:function(){ - return this.select.options.length ; + } }, trimSuperUnarySelectedOptions:function(){ @@ -185,15 +124,14 @@ var val = select.value ; if( val ){ result.value = val ; - if( select.selectedIndex != -1 ){ - result.text - = select.options[select.selectedIndex].text - } } + if( select.selectedIndex != -1 ){ + result.text = select.options[select.selectedIndex].text + } } else { // Must step through - var arrTexts = new Array(0) ; - var arrValues = new Array(0) ; + var arrTexts = []; + var arrValues = []; var node = select.firstChild ; var siz = select.size ; while( node ){ @@ -209,79 +147,17 @@ result.value = arrValues ; } return result ; - }, // getTextValuePairs - refreshSelectBox:function(bForceFocus){ - var parentNode = this.select.parentNode ; - if( parentNode ){ - var next = this.select.nextSibling ; - // no remove necessary; this seems to work under IE, - // which is where it's needed, even though - // the net effect is naught, because you can't - // insert the same child twice: - parentNode.insertBefore(this.select,next) ; - } - if(bForceFocus){ - this.select.focus() ; - } - }, - onStructureChange:function(){ - // just a place to put a handler's hook } } ); -//Avoid "puppetry"---that is, make this widget able to handle things for itself, -//leaving the bridge class to call these methods---much better if we have to change -// this class: -xap.widgets.ListBox.prototype.setVisible = function(value){ - this.domNode.style.visibility = (value=="false")?"hidden":"visible" ; -} - - -xap.widgets.ListBox.prototype.setX = function(value) { - this.domNode.style.left = value ; -} - -xap.widgets.ListBox.prototype.setY = function(value) { - this.domNode.style.top = value; -} - - -xap.widgets.ListBox.prototype.setBackgroundColor = function(value){ - this.select.style.backgroundColor = value ; -} - - -xap.widgets.ListBox.prototype.setColor = function(value){ - this.select.style.color = value ; -} - -xap.widgets.ListBox.prototype.setFontFamily = function(value){ - this.select.style.fontFamily = value ; -} - -xap.widgets.ListBox.prototype.setFontSize = function(value){ - this.select.style.fontSize = value ; -} - -xap.widgets.ListBox.prototype.setFontStyle = function(value){ - this.select.style.fontStyle = value ; -} - -xap.widgets.ListBox.prototype.setFontWeight = function(value){ - this.select.style.fontWeight = value ; -} - - - /** * @param bValue{boolean}---note that the string * "false" evaluates to the truth boolean **/ xap.widgets.ListBox.prototype.setDisabled = function(bValue){ - this.domNode.disabled = bValue ; this.select.disabled = bValue ; } Modified: incubator/xap/trunk/codebase/src/xap/widgets/ListItem.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/ListItem.js?rev=573942&r1=573941&r2=573942&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/widgets/ListItem.js (original) +++ incubator/xap/trunk/codebase/src/xap/widgets/ListItem.js Sat Sep 8 19:00:33 2007 @@ -35,15 +35,16 @@ templateCssPath: null, widgetType: "ListItem", isContainer: true, - fillInTemplate: function(){ - this.domNode = document.createElement("option"); + + //the peer object here is not an html dom node but + //an actual Option object. This is because removing/adding + //domNodes from a select does not work well overall + postCreate: function(){ + this.domNode = new Option(); }, - setDetail: function(text, value) { - this.domNode.text = text; - this.domNode.value = value; - }, - setSelected: function() { - this.domNode.selected = true; + + setSelected: function( value ) { + this.domNode.selected = value; }, isSelected: function(){ Modified: incubator/xap/trunk/codebase/src/xap/widgets/XapComboBox.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/XapComboBox.js?rev=573942&r1=573941&r2=573942&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/widgets/XapComboBox.js (original) +++ incubator/xap/trunk/codebase/src/xap/widgets/XapComboBox.js Sat Sep 8 19:00:33 2007 @@ -43,130 +43,10 @@ templateString: '<div></div>', templateCssPath: null, widgetType: 'XapComboBox', - isContainer: true, - - addChild: function(child) { - xap.widgets.XapComboBox.superclass.addChild.call(this, child); /* add dojo widget to dojo widget */ - this.child = child ; - this.fixIe6Height() ; - }, - - - resetNode: function(containerNode){ - } + isContainer: true } ); dojo.widget.tags.addParseTreeHandler("dojo:XapComboBox"); - -xap.widgets.XapComboBox.prototype.setVisible = function(value){ - this.domNode.style.visibility = (value=="true")?"visible":"hidden" ; - if( this.child ){ - this.child.setVisible(value) ; - } - this.domNode.style.visibility = (value=="false")?"hidden":"visible" ; -} - -xap.widgets.XapComboBox.prototype.setBackgroundColor = function(value){ - if( this.child ){ - this.child.setBackgroundColor( value ) ; - } - this.domNode.style.backgroundColor = value ; -} - -xap.widgets.XapComboBox.prototype.setColor = function(value){ - if( this.child ){ - this.child.setColor( value ) ; - } - this.domNode.style.color = value ; -} - - - -xap.widgets.XapComboBox.prototype.setWidth = function (value) { - if (this.child) { - this.child.domNode.style.width ="100%"; - } - -}; -xap.widgets.XapComboBox.prototype.setHeight = function (value) { - if (this.child) { - this.child.domNode.style.height = "100%"; - - var newHeight = this.domNode.clientHeight ; - if( window.netscape ){ - // For once, Mozilla handles something - // worse than does Internet Explorer: - var fudgeDelta = 2 ; - newHeight = Math.max(newHeight - fudgeDelta,0) ; - } - dojo.style.setOuterHeight(this.child.select, newHeight); - } - this.fixIe6Height() ; -}; - - -xap.widgets.XapComboBox.prototype.fixIe6Height = function() { - if( (navigator.appVersion.indexOf("MSIE 6") > -1) && this.child && this.child.select && this.child.select.clientHeight ){ - this.domNode.style.height = this.child.select.clientHeight +"px" ; - } -} - - -xap.widgets.XapComboBox.prototype.setBorderColor = function(value){ - this.domNode.style.borderColor = value ; -} -xap.widgets.XapComboBox.prototype.setBorderStyle = function(value){ - this.domNode.style.borderStyle = value ; -} - -xap.widgets.XapComboBox.prototype.setBorderWidth = function(value){ - this.domNode.style.borderWidth = value ; -} - -xap.widgets.XapComboBox.prototype.setX = function(value){ - this.domNode.style.left = value ; - if(this.child){ - this.child.setX( value ) ; - } -} - -xap.widgets.XapComboBox.prototype.setY = function(value){ - this.domNode.style.top = value ; - if(this.child){ - this.child.setY( value ) ; - } -} - - -xap.widgets.XapComboBox.prototype.setFontColor = function(value) { - if(this.child){ - this.child.setFontColor( value ) ; - } -} -xap.widgets.XapComboBox.prototype.setFontStyle = function(value) { - if(this.child){ - this.child.setFontStyle( value ) ; - } -} -xap.widgets.XapComboBox.prototype.setFontWeight = function(value) { - if(this.child){ - this.child.setFontWeight( value ) ; - } -} -xap.widgets.XapComboBox.prototype.setFontSize = function(value) { - if(this.child){ - this.child.setFontSize( value ) ; - } -} -xap.widgets.XapComboBox.prototype.setFontFamily = function(value) { - if(this.child){ - this.child.setFontFamily( value ) ; - } -} - - - - From xap-commits-returnwford@example.com Tue Sep 11 01:51:31 2007 Return-Path: <xap-commits-returnwford@example.com> Delivered-To: wford@example.com Received: (qmail 56434 invoked from network); 11 Sep 2007 01:51:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Sep 2007 01:51:31 -0000 Received: (qmail 33327 invoked by uid 500); 11 Sep 2007 01:51:25 -0000 Delivered-To: wford@example.com Received: (qmail 33305 invoked by uid 500); 11 Sep 2007 01:51:25 -0000 Mailing-List: contact wford@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:wford@example.com> List-Unsubscribe: <mailto:wford@example.com> List-Post: <mailto:wford@example.com> List-Id: <xap-commits.incubator.apache.org> Reply-To: wford@example.com Delivered-To: mailing list wford@example.com Received: (qmail 33286 invoked by uid 99); 11 Sep 2007 01:51:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Sep 2007 18:51:25 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 01:53:03 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B9B521A9832; Mon, 10 Sep 2007 18:51:08 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r574425 - /incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js Date: Tue, 11 Sep 2007 01:51:08 -0000 To: wford@example.com From: wford@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <wford@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: jmargaris Date: Mon Sep 10 18:51:08 2007 New Revision: 574425 URL: http://svn.apache.org/viewvc?rev=574425&view=rev Log: now not immediately failing on evalOnObject due to misnamed var Modified: incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js Modified: incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js?rev=574425&r1=574424&r2=574425&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js (original) +++ incubator/xap/trunk/codebase/src/xap/data/datasource/ObjectDataSource.js Mon Sep 10 18:51:08 2007 @@ -77,7 +77,7 @@ */ xap.data.datasource.ObjectDataSource.prototype.evalOnObject = function( evalText, object){ //if the text is just "this" return, this will work with strings - if (text=='this'){ + if (evalText=='this'){ return object; } if (!object._eval){ From xap-commits-returnwford@example.com Tue Sep 11 03:09:33 2007 Return-Path: <xap-commits-returnwford@example.com> Delivered-To: wford@example.com Received: (qmail 76533 invoked from network); 11 Sep 2007 03:09:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Sep 2007 03:09:33 -0000 Received: (qmail 86785 invoked by uid 500); 11 Sep 2007 03:09:26 -0000 Delivered-To: wford@example.com Received: (qmail 86766 invoked by uid 500); 11 Sep 2007 03:09:26 -0000 Mailing-List: contact wford@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:wford@example.com> List-Unsubscribe: <mailto:wford@example.com> List-Post: <mailto:wford@example.com> List-Id: <xap-commits.incubator.apache.org> Reply-To: wford@example.com Delivered-To: mailing list wford@example.com Received: (qmail 86756 invoked by uid 99); 11 Sep 2007 03:09:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Sep 2007 20:09:26 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 03:11:04 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3978D1A9832; Mon, 10 Sep 2007 20:09:10 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r574440 - /incubator/xap/trunk/codebase/src/xap/widgets/dojo/GridPanel.js Date: Tue, 11 Sep 2007 03:09:09 -0000 To: wford@example.com From: wford@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <wford@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: jmargaris Date: Mon Sep 10 20:09:09 2007 New Revision: 574440 URL: http://svn.apache.org/viewvc?rev=574440&view=rev Log: no longer crashing in IE Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/GridPanel.js Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/GridPanel.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/GridPanel.js?rev=574440&r1=574439&r2=574440&view=diff ============================================================================== --- incubator/xap/trunk/codebase/src/xap/widgets/dojo/GridPanel.js (original) +++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/GridPanel.js Mon Sep 10 20:09:09 2007 @@ -118,10 +118,6 @@ cell.rowSpan = rowSpan; cell.colSpan = columnSpan; - cell.style.borderColor="red"; - cell.style.borderStyle="solid"; - cell.style.borderWidth="1px"; - if (constraints._vAlign=='start'){ cell.vAlign = 'top'; //TODO should this be style based? } @@ -142,12 +138,7 @@ this.containerNode = cell; xap.widgets.dojo.GridPanel.superclass.addChild.call(this,child); - }, - - - removeChild: function(child) { - //TODO now what? - } + } } ); From xap-commits-returnwford@example.com Wed Sep 12 01:38:16 2007 Return-Path: <xap-commits-returnwford@example.com> Delivered-To: wford@example.com Received: (qmail 33634 invoked from network); 12 Sep 2007 01:38:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 12 Sep 2007 01:38:16 -0000 Received: (qmail 31808 invoked by uid 500); 12 Sep 2007 01:38:09 -0000 Delivered-To: wford@example.com Received: (qmail 31785 invoked by uid 500); 12 Sep 2007 01:38:09 -0000 Mailing-List: contact wford@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:wford@example.com> List-Unsubscribe: <mailto:wford@example.com> List-Post: <mailto:wford@example.com> List-Id: <xap-commits.incubator.apache.org> Reply-To: wford@example.com Delivered-To: mailing list wford@example.com Received: (qmail 31776 invoked by uid 99); 12 Sep 2007 01:38:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 18:38:09 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2007 01:38:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id ECB261A9838; Tue, 11 Sep 2007 18:37:54 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r574753 - in /incubator/xap/site: download.html index.html Date: Wed, 12 Sep 2007 01:37:54 -0000 To: wford@example.com From: wford@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <wford@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: bbuffone Date: Tue Sep 11 18:37:54 2007 New Revision: 574753 URL: http://svn.apache.org/viewvc?rev=574753&view=rev Log: added the Prototype and Mootools xModify extensions Modified: incubator/xap/site/download.html incubator/xap/site/index.html Modified: incubator/xap/site/download.html URL: http://svn.apache.org/viewvc/incubator/xap/site/download.html?rev=574753&r1=574752&r2=574753&view=diff ============================================================================== --- incubator/xap/site/download.html (original) +++ incubator/xap/site/download.html Tue Sep 11 18:37:54 2007 @@ -138,7 +138,7 @@ </tbody> </table> -<br /><br /><b>xModify Processors:</b><br /><br /> +<br /><br /><b>xModify Processors are packaged separately:</b><br /><br /> Below are the file needed for using just the xModify processing engines. <br>For more information on the xModify, <a href="docs/xmodify/frame-index.html">Click Here</a>. <ul><li><b>xModify for jQuery</b><br><br> <a style="font-weight:bold" href="javascript/xmodify/xmodify-jquery.js" onClick="javascript:urchinTracker('/download/xmodify-jquery.js');">xmodify-jquery.js</a> (Uncompressed) (9 KB)<br> @@ -149,6 +149,16 @@ <a style="font-weight:bold" href="javascript/xap/XapConfig-Min.js" onClick="javascript:urchinTracker('/download/XapConfig-Min.js');">XapConfig-Min.js</a> (Compressed) (4 KB) </li> +<li><br><b>xModify for Prototype</b><br><br> + <a style="font-weight:bold" href="javascript/xap/xmodify-prototype.js" onClick="javascript:urchinTracker('/download/xmodify-prototype.js');">xmodify-prototype-compressed.js</a> (Uncompressed) (11 KB)<br> + <a style="font-weight:bold" href="javascript/xap/xmodify-prototype-compressed.js" onClick="javascript:urchinTracker('/download/xmodify-prototype-compressed.js');">xmodify-prototype-compressed.js</a> (Compressed) (4 KB) + +</li> +<li><br><b>xModify for Mootools</b><br><br> + <a style="font-weight:bold" href="javascript/xap/xmodify-mootools.js" onClick="javascript:urchinTracker('/download/xmodify-mootools.js');">xmodify-mootools-compressed.js</a> (Uncompressed) (11 KB)<br> + <a style="font-weight:bold" href="javascript/xap/xmodify-mootools-compressed.js" onClick="javascript:urchinTracker('/download/xmodify-mootools-compressed.js');">xmodify-mootools-compressed.js</a> (Compressed) (4 KB) + +</li> </ul> <br /><img src="images/bt_bullet_2.gif" border=0 alt="bullet"> <a href="http://wiki.apache.org/incubator/xap/XAP030" >See the release notes for latest version information and a list of what's new</a>.<br /><br />The latest code is available from the subversion repository. <a href="repository.html">Click Here!</a> for information how to check XAP out of SVN.<br /><br /><span class="Title">Getting Started</span><br /><br /><img src="images/bt_bullet_2.gif" border=0 alt="bullet"> <span style="font-weight: bold;">After downloading</span> <span style="font-weight: bold;">see </span>- <a href="http://wiki.apache.org/incubator/xap" >Get Started Here</a><div style="margin-top: 6px; text-align: left; font-size: 8pt; color: grey;">(last update - 26-Feb-07)</div><image src="./images/spaced.gif" border=0 height=8><br></div></td></tr></table> Modified: incubator/xap/site/index.html URL: http://svn.apache.org/viewvc/incubator/xap/site/index.html?rev=574753&r1=574752&r2=574753&view=diff ============================================================================== --- incubator/xap/site/index.html (original) +++ incubator/xap/site/index.html Tue Sep 11 18:37:54 2007 @@ -212,7 +212,7 @@ <div align="center"><a href="docs/xmodify/frame-index.html"><b>Check out the documentation</b></a><br><br></div> - <div align="center" style="background-color:#EFF;border:1px solid orange;align:center;padding-left:20px;padding-right:20px;"><h2>3 KB implementation <br>on top of jQuery</h2> + <div align="center" style="background-color:#EFF;border:1px solid orange;align:center;padding-left:20px;padding-right:20px;"><h2>3 KB implementation <br>on top of jQuery, Mootools, Prototype</h2> Click the <b>"Processors"</b> link in the <a href="docs/xmodify/frame-index.html">xModify documentation</a> section.</a><br><br></div> <br><br> From xap-commits-returnwford@example.com Wed Sep 12 01:38:33 2007 Return-Path: <xap-commits-returnwford@example.com> Delivered-To: wford@example.com Received: (qmail 33683 invoked from network); 12 Sep 2007 01:38:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 12 Sep 2007 01:38:33 -0000 Received: (qmail 31905 invoked by uid 500); 12 Sep 2007 01:38:26 -0000 Delivered-To: wford@example.com Received: (qmail 31885 invoked by uid 500); 12 Sep 2007 01:38:26 -0000 Mailing-List: contact wford@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:wford@example.com> List-Unsubscribe: <mailto:wford@example.com> List-Post: <mailto:wford@example.com> List-Id: <xap-commits.incubator.apache.org> Reply-To: wford@example.com Delivered-To: mailing list wford@example.com Received: (qmail 31874 invoked by uid 99); 12 Sep 2007 01:38:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 18:38:26 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2007 01:38:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1F06C1A9832; Tue, 11 Sep 2007 18:38:12 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r574754 - /incubator/xap/site/main.css Date: Wed, 12 Sep 2007 01:38:11 -0000 To: wford@example.com From: wford@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <wford@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: bbuffone Date: Tue Sep 11 18:38:11 2007 New Revision: 574754 URL: http://svn.apache.org/viewvc?rev=574754&view=rev Log: added the Prototype and Mootools xModify extensions Modified: incubator/xap/site/main.css Modified: incubator/xap/site/main.css URL: http://svn.apache.org/viewvc/incubator/xap/site/main.css?rev=574754&r1=574753&r2=574754&view=diff ============================================================================== --- incubator/xap/site/main.css (original) +++ incubator/xap/site/main.css Tue Sep 11 18:38:11 2007 @@ -152,5 +152,5 @@ pre{ border:1px solid #aaa; - background-color:#eee; + background-color:#fff; } From xap-commits-returnwford@example.com Wed Sep 12 01:39:12 2007 Return-Path: <xap-commits-returnwford@example.com> Delivered-To: wford@example.com Received: (qmail 33745 invoked from network); 12 Sep 2007 01:39:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 12 Sep 2007 01:39:12 -0000 Received: (qmail 32001 invoked by uid 500); 12 Sep 2007 01:39:05 -0000 Delivered-To: wford@example.com Received: (qmail 31980 invoked by uid 500); 12 Sep 2007 01:39:05 -0000 Mailing-List: contact wford@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:wford@example.com> List-Unsubscribe: <mailto:wford@example.com> List-Post: <mailto:wford@example.com> List-Id: <xap-commits.incubator.apache.org> Reply-To: wford@example.com Delivered-To: mailing list wford@example.com Received: (qmail 31971 invoked by uid 99); 12 Sep 2007 01:39:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 18:39:05 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2007 01:40:46 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C7A4C1A9832; Tue, 11 Sep 2007 18:38:49 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r574755 [1/3] - in /incubator/xap/site/javascript: prototype/ prototype/prototype.js xmodify/xmodify-mootools-compressed.js xmodify/xmodify-mootools.js xmodify/xmodify-prototype-compressed.js xmodify/xmodify-prototype.js Date: Wed, 12 Sep 2007 01:38:49 -0000 To: wford@example.com From: wford@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <wford@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: bbuffone Date: Tue Sep 11 18:38:48 2007 New Revision: 574755 URL: http://svn.apache.org/viewvc?rev=574755&view=rev Log: added the Prototype and Mootools xModify extensions Added: incubator/xap/site/javascript/prototype/ incubator/xap/site/javascript/prototype/prototype.js incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js incubator/xap/site/javascript/xmodify/xmodify-mootools.js incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js incubator/xap/site/javascript/xmodify/xmodify-prototype.js From xap-commits-returnwford@example.com Wed Sep 12 01:39:21 2007 Return-Path: <xap-commits-returnwford@example.com> Delivered-To: wford@example.com Received: (qmail 33770 invoked from network); 12 Sep 2007 01:39:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 12 Sep 2007 01:39:21 -0000 Received: (qmail 32043 invoked by uid 500); 12 Sep 2007 01:39:14 -0000 Delivered-To: wford@example.com Received: (qmail 32028 invoked by uid 500); 12 Sep 2007 01:39:14 -0000 Mailing-List: contact wford@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:wford@example.com> List-Unsubscribe: <mailto:wford@example.com> List-Post: <mailto:wford@example.com> List-Id: <xap-commits.incubator.apache.org> Reply-To: wford@example.com Delivered-To: mailing list wford@example.com Received: (qmail 32019 invoked by uid 99); 12 Sep 2007 01:39:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 18:39:14 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2007 01:39:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E1DF31A983A; Tue, 11 Sep 2007 18:38:49 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r574755 [2/3] - in /incubator/xap/site/javascript: prototype/ prototype/prototype.js xmodify/xmodify-mootools-compressed.js xmodify/xmodify-mootools.js xmodify/xmodify-prototype-compressed.js xmodify/xmodify-prototype.js Date: Wed, 12 Sep 2007 01:38:49 -0000 To: wford@example.com From: wford@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <wford@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Added: incubator/xap/site/javascript/prototype/prototype.js URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/prototype/prototype.js?rev=574755&view=auto ============================================================================== --- incubator/xap/site/javascript/prototype/prototype.js (added) +++ incubator/xap/site/javascript/prototype/prototype.js Tue Sep 11 18:38:48 2007 @@ -0,0 +1,4174 @@ +/* Prototype JavaScript framework, version 1.6.0_rc0 + * (c) 2005-2007 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * + *--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.6.0_rc0', + + Browser: { + IE: !!(window.attachEvent && !window.opera), + Opera: !!window.opera, + WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, + Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1, + MobileSafari: !!navigator.userAgent.match(/iPhone.*Mobile.*Safari/) + }, + + BrowserFeatures: { + XPath: !!document.evaluate, + ElementExtensions: !!window.HTMLElement, + SpecificElementExtensions: + document.createElement('div').__proto__ !== + document.createElement('form').__proto__ + }, + + ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, + + emptyFunction: function() { }, + K: function(x) { return x } +}; + +if (Prototype.Browser.MobileSafari) + Prototype.BrowserFeatures.SpecificElementExtensions = false; + +/* Based on Alex Arnell's inheritance implementation. */ +var Class = { + create: function(parent, methods) { + if (arguments.length == 1 && !Object.isFunction(parent)) + methods = parent, parent = null; + + var method = function() { + if (!Class.extending) this.initialize.apply(this, arguments); + }; + + method.superclass = parent; + method.subclasses = []; + + if (Object.isFunction(parent)) { + Class.extending = true; + method.prototype = new parent(); + + parent.subclasses.push(method); + + delete Class.extending; + } + + if (methods) Class.extend(method, methods); + method.prototype.constructor = method; + + return method; + }, + + extend: function(destination, source) { + for (var name in source) Class.inherit(destination, source, name); + return destination; + }, + + inherit: function(destination, source, name) { + var prototype = destination.prototype, ancestor = prototype[name], + descendant = source[name]; + if (ancestor && Object.isFunction(descendant) && + descendant.argumentNames().first() == "$super") { + var method = descendant, descendant = ancestor.wrap(method); + Object.extend(descendant, { + valueOf: function() { return method }, + toString: function() { return method.toString() } + }); + } + + prototype[name] = descendant; + + if (destination.subclasses && destination.subclasses.length > 0) { + for (var i = 0, subclass; subclass = destination.subclasses[i]; i++) { + Class.extending = true; + Object.extend(subclass.prototype, new destination()); + subclass.prototype.constructor = subclass; + delete Class.extending; + Class.inherit(subclass, destination.prototype, name); + } + } + }, + + mixin: function(destination, source) { + return Object.extend(destination, source); + } +}; + +var Abstract = { }; + +Object.extend = function(destination, source) { + for (var property in source) { + destination[property] = source[property]; + } + return destination; +}; + +Object.extend(Object, { + inspect: function(object) { + try { + if (object === undefined) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : object.toString(); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + toJSON: function(object) { + var type = typeof object; + switch (type) { + case 'undefined': + case 'function': + case 'unknown': return; + case 'boolean': return object.toString(); + } + + if (object === null) return 'null'; + if (object.toJSON) return object.toJSON(); + if (Object.isElement(object)) return; + + var results = []; + for (var property in object) { + var value = Object.toJSON(object[property]); + if (value !== undefined) + results.push(property.toJSON() + ': ' + value); + } + + return '{' + results.join(', ') + '}'; + }, + + toHTML: function(object) { + return object && object.toHTML ? object.toHTML() : String.interpret(object); + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({ }, object); + }, + + isElement: function(object) { + return object && object.nodeType == 1; + }, + + isArray: function(object) { + return object && object.constructor === Array; + }, + + isFunction: function(object) { + return typeof object == "function"; + }, + + isString: function(object) { + return typeof object == "string"; + }, + + isNumber: function(object) { + return typeof object == "number"; + }, + + isUndefined: function(object) { + return typeof object == "undefined"; + } +}); + +Object.extend(Function.prototype, { + argumentNames: function() { + var names = this.toString().match(/^[\s\(]*function\s*\((.*?)\)/)[1].split(",").invoke("strip"); + return names.length == 1 && !names[0] ? [] : names; + }, + + bind: function() { + if (arguments.length < 2 && arguments[0] === undefined) return this; + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } + }, + + bindAsEventListener: function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [event || window.event].concat(args)); + } + }, + + curry: function() { + if (!arguments.length) return this; + var __method = this, args = $A(arguments); + return function() { + return __method.apply(this, args.concat($A(arguments))); + } + }, + + delay: function() { + var __method = this, args = $A(arguments), timeout = args.shift() * 1000; + return window.setTimeout(function() { + return __method.apply(__method, args); + }, timeout); + }, + + wrap: function(wrapper) { + var __method = this; + return function() { + return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); + } + }, + + methodize: function() { + if (this._methodized) return this._methodized; + var __method = this; + return this._methodized = function() { + return __method.apply(null, [this].concat($A(arguments))); + }; + } +}); + +Function.prototype.defer = Function.prototype.delay.curry(0.01); + +Date.prototype.toJSON = function() { + return '"' + this.getFullYear() + '-' + + (this.getMonth() + 1).toPaddedString(2) + '-' + + this.getDate().toPaddedString(2) + 'T' + + this.getHours().toPaddedString(2) + ':' + + this.getMinutes().toPaddedString(2) + ':' + + this.getSeconds().toPaddedString(2) + '"'; +}; + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) { } + } + + return returnValue; + } +}; + +RegExp.prototype.match = RegExp.prototype.test; + +RegExp.escape = function(str) { + return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); +}; + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create({ + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.callback(this); + } finally { + this.currentlyExecuting = false; + } + } + } +}); +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = count === undefined ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return String(this); + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = truncation === undefined ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : String(this); + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var self = arguments.callee; + self.text.data = this; + return self.div.innerHTML; + }, + + unescapeHTML: function() { + var div = new Element('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return { }; + + return match[1].split(separator || '&').inject({ }, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()); + var value = pair.length > 1 ? pair.join('=') : pair[0]; + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + times: function(count) { + var result = ''; + for (var i = 0; i < count; i++) result += this; + return result; + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { + var character = String.specialChar[match[0]]; + return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + }, + + toJSON: function() { + return this.inspect(true); + }, + + unfilterJSON: function(filter) { + return this.sub(filter || Prototype.JSONFilter, '#{1}'); + }, + + isJSON: function() { + var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); + return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); + }, + + evalJSON: function(sanitize) { + var json = this.unfilterJSON(); + try { + if (!sanitize || json.isJSON()) return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + }, + + include: function(pattern) { + return this.indexOf(pattern) > -1; + }, + + startsWith: function(pattern) { + return this.indexOf(pattern) === 0; + }, + + endsWith: function(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.lastIndexOf(pattern) === d; + }, + + empty: function() { + return this == ''; + }, + + blank: function() { + return /^\s*$/.test(this); + }, + + interpolate: function(object, pattern) { + return new Template(this, pattern).evaluate(object); + } +}); + +if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { + escapeHTML: function() { + return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); + }, + unescapeHTML: function() { + return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>'); + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (Object.isFunction(replacement)) return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +}; + +String.prototype.parseQuery = String.prototype.toQueryParams; + +Object.extend(String.prototype.escapeHTML, { + div: document.createElement('div'), + text: document.createTextNode('') +}); + +with (String.prototype.escapeHTML) div.appendChild(text); + +var Template = Class.create(); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; +Template.prototype = { + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + if (Object.isFunction(object.toTemplateReplacements)) + object = object.toTemplateReplacements(); + + return this.template.gsub(this.pattern, function(match) { + if (object == null) return ''; + + var before = match[1] || ''; + if (before == '\\') return match[2]; + + var ctx = object, expr = match[3]; + var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr); + if (match == null) return ''; + + while (match != null) { + var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; + ctx = ctx[comp]; + if (null == ctx || '' == match[3]) break; + expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); + match = pattern.exec(expr); + } + + return before + String.interpret(ctx); + }.bind(this)); + } +}; + +var $break = { }; + +var Enumerable = { + each: function(iterator, context) { + var index = 0; + iterator = iterator.bind(context); + try { + this._each(function(value) { + iterator(value, index++); + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + }, + + eachSlice: function(number, iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var index = -number, slices = [], array = this.toArray(); + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.collect(iterator, context); + }, + + all: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result = true; + this.each(function(value, index) { + result = result && !!iterator(value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result = false; + this.each(function(value, index) { + if (result = !!iterator(value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var results = []; + this.each(function(value, index) { + results.push(iterator(value, index)); + }); + return results; + }, + + detect: function(iterator, context) { + iterator = iterator.bind(context); + var result; + this.each(function(value, index) { + if (iterator(value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator, context) { + iterator = iterator.bind(context); + var results = []; + this.each(function(value, index) { + if (iterator(value, index)) + results.push(value); + }); + return results; + }, + + grep: function(filter, iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var results = []; + + if (Object.isString(filter)) + filter = new RegExp(filter); + + this.each(function(value, index) { + if (filter.match(value)) + results.push(iterator(value, index)); + }); + return results; + }, + + include: function(object) { + if (Object.isFunction(this.indexOf)) + return this.indexOf(object) != -1; + + var found = false; + this.each(function(value) { + if (value === object) { + found = true; + throw $break; + } + }); + return found; + }, + + inGroupsOf: function(number, fillWith) { + fillWith = fillWith === undefined ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + }, + + inject: function(memo, iterator, context) { + iterator = iterator.bind(context); + this.each(function(value, index) { + memo = iterator(memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result; + this.each(function(value, index) { + value = iterator(value, index); + if (result == undefined || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result; + this.each(function(value, index) { + value = iterator(value, index); + if (result == undefined || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var trues = [], falses = []; + this.each(function(value, index) { + (iterator(value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator, context) { + iterator = iterator.bind(context); + var results = []; + this.each(function(value, index) { + if (!iterator(value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator, context) { + iterator = iterator.bind(context); + return this.map(function(value, index) { + return {value: value, criteria: iterator(value, index)}; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.map(); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (Object.isFunction(args.last())) + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + size: function() { + return this.toArray().length; + }, + + inspect: function() { + return '#<Enumerable:' + this.toArray().inspect() + '>'; + } +}; + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + filter: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray, + every: Enumerable.all, + some: Enumerable.any +}); +function $A(iterable) { + if (!iterable) return []; + if (iterable.toArray) return iterable.toArray(); + else { + var results = []; + for (var i = 0, length = iterable.length; i < length; i++) + results.push(iterable[i]); + return results; + } +} + +if (Prototype.Browser.WebKit) { + function $A(iterable) { + if (!iterable) return []; + if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && + iterable.toArray) { + return iterable.toArray(); + } else { + var results = []; + for (var i = 0, length = iterable.length; i < length; i++) + results.push(iterable[i]); + return results; + } + } +} + +Array.from = $A; + +Object.extend(Array.prototype, Enumerable); + +if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0, length = this.length; i < length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(Object.isArray(value) ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + reduce: function() { + return this.length > 1 ? this : this[0]; + }, + + uniq: function(sorted) { + return this.inject([], function(array, value, index) { + if (0 == index || (sorted ? array.last() != value : !array.include(value))) + array.push(value); + return array; + }); + }, + + intersect: function(array) { + return this.uniq().findAll(function(item) { + return array.include(item); + }); + }, + + clone: function() { + return [].concat(this); + }, + + size: function() { + return this.length; + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + }, + + toJSON: function() { + var results = []; + this.each(function(object) { + var value = Object.toJSON(object); + if (value !== undefined) results.push(value); + }); +
{'source': 'Apache Software Foundation Public Mail Archives'}