diff --git a/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.html b/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.html new file mode 100644 index 00000000000..7c0cfa7bbea --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.html @@ -0,0 +1,102 @@ + + + +

Auto Compelte Test Page

+
+

I created a MooTools version of AutoCompleter.Base, Ajax.Autocompleter and Autocompleter.Local check out AutoCompleter.js

+ + + + +
+ + + + + + + ( chars) + + + + + + + +
\ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.wod b/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.wod new file mode 100644 index 00000000000..5b64722a509 --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.wod @@ -0,0 +1,32 @@ +ComplexAjaxAutoComplete: MTAjaxAutoComplete { + list = currentValues; + value = value; + item = currentValue; + selection = selectedValue; +} + +Item : WOString { + value = currentValue.name; +} + +ItemLength : WOString { + value = currentValue.value; +} + +SimpleAjaxAutoComplete: MTAjaxAutoComplete { + list = currentValues2; + value = value2; + item = currentValue; + displayString = currentValue.name; + selection = selectedValue2; +} + +SubmitButton : WOSubmitButton { + action = submitted; +} + +WOForm : WOForm { + class = "well"; +} + + diff --git a/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.woo b/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.woo new file mode 100644 index 00000000000..a076a051a7e --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Components/MTAjaxAutoCompleteTestPage.wo/MTAjaxAutoCompleteTestPage.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} \ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Components/MTAjaxExpansionTestPage.wo/MTAjaxExpansionTestPage.html b/Examples/Ajax/MooToolsExample/Components/MTAjaxExpansionTestPage.wo/MTAjaxExpansionTestPage.html new file mode 100644 index 00000000000..a2eddf86118 --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Components/MTAjaxExpansionTestPage.wo/MTAjaxExpansionTestPage.html @@ -0,0 +1,64 @@ + +

Ajax Expansion...

+
+

+ AjaxExpansion provides an easy way to make expansion areas that appear and disappear by clicking a link (for instance, expandable options areas). +

+

+ Should work like the original. +

+

+ TODO: Work on the effects. +

+
+
+

Brazil Nut

+ + + profile +
+
Phone Number
+
+ 808.EAT.BRDS +
+ +
Address
+
+ 123 MaccaDangDang Hwy.
+ Maui, HI 96761 +
+ +
URL
+
+ http://kahalawai.com/ +
+
+
+ + profile + +
+
+
+

Coco Nut

+ +
+
Phone Number
+
+ 808.EAT.BRDS +
+ +
Address
+
+ 123 MaccaDangDang Hwy.
+ Maui, HI 96761 +
+ +
URL
+
+ http://kahalawai.com/ +
+
+
+
+
\ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Components/MTAjaxExpansionTestPage.wo/MTAjaxExpansionTestPage.wod b/Examples/Ajax/MooToolsExample/Components/MTAjaxExpansionTestPage.wo/MTAjaxExpansionTestPage.wod new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Examples/Ajax/MooToolsExample/Components/MTAjaxExpansionTestPage.wo/MTAjaxExpansionTestPage.woo b/Examples/Ajax/MooToolsExample/Components/MTAjaxExpansionTestPage.wo/MTAjaxExpansionTestPage.woo new file mode 100644 index 00000000000..a076a051a7e --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Components/MTAjaxExpansionTestPage.wo/MTAjaxExpansionTestPage.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} \ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.html b/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.html new file mode 100644 index 00000000000..4256f7a21e7 --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.html @@ -0,0 +1,22 @@ + +

MTStyledPopUpButton

+
+

MTStyledPopUpButton is a non-obtrusive image dropdown menu that extends and replaces a standard HTML Select control. Based upon "FancySelect" @ https://github.com/lorenzos/FancySelect/wiki

+
+

Sample using a component action.

+ + + + + +

Sample using a direct action.

+ + + + + + +
+

Your favorite fruit is:

+
+
\ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.wod b/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.wod new file mode 100644 index 00000000000..3146e1dd5f9 --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.wod @@ -0,0 +1,27 @@ +DirectActionSubmitButton : WOSubmitButton { + class = "btn btn-primary"; + directActionName = "PageAction/MTStyledPopUpButtonTestPage"; +} + +MTStyledPopUpButton : MTStyledPopUpButton { + item = item; + list = list; + selection = selectedItem; + showImages = false; + onShow = "function() { console.log('showing popup options...') }"; +} + +MTStyledSelectedValuePopUpButton : MTStyledPopUpButton { + item = item; + list = list; + name = "FavFruit"; + selectedValue = selectedItem; + showImages = false; + onShow = "function() { console.log('showing popup options...') }"; + value = item; +} + +SubmitButton : WOSubmitButton { + action = selectFruit; + class = "btn btn-primary"; +} \ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.woo b/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.woo new file mode 100644 index 00000000000..a076a051a7e --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Components/MTStyledPopUpButtonTestPage.wo/MTStyledPopUpButtonTestPage.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} \ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTAjaxAutoCompleteTestPage.java b/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTAjaxAutoCompleteTestPage.java new file mode 100644 index 00000000000..92344252ac8 --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTAjaxAutoCompleteTestPage.java @@ -0,0 +1,54 @@ +package er.ajax.mootools.example.components; + +import java.util.Enumeration; + +import com.webobjects.appserver.WOActionResults; +import com.webobjects.appserver.WOContext; +import com.webobjects.foundation.NSArray; +import com.webobjects.foundation.NSMutableArray; + +public class MTAjaxAutoCompleteTestPage extends Main { + + public String value; + public String value2; + + public NSArray allValues; + public Word currentValue; + public Word selectedValue; + public Word selectedValue2; + + public MTAjaxAutoCompleteTestPage(WOContext context) { + super(context); + allValues = ExampleDataFactory.allWords(); + } + + /** + * This method gets called after every keystroke, we check the value variable and return the 10 entries + * in allValues that contain this value. + */ + public NSArray currentValues(String v) { + NSMutableArray result = new NSMutableArray(); + for(Enumeration e = allValues.objectEnumerator(); e.hasMoreElements() && result.count() < 10;) { + Word c = (Word) e.nextElement(); + if(v == null || c.name.toLowerCase().indexOf(v.toLowerCase()) >= 0) { + result.addObject(c); + } + } + return result; + } + + public NSArray currentValues() { + return currentValues(value); + } + + public NSArray currentValues2() { + return currentValues(value2); + } + + public WOActionResults submitted() { + System.out.println("AutoCompleteExample.submitted: " + value + ", " + selectedValue); + System.out.println("AutoCompleteExample.submitted: " + value2 + ", " + selectedValue2); + return null; + } + +} \ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTAjaxExpansionTestPage.java b/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTAjaxExpansionTestPage.java new file mode 100644 index 00000000000..e82a006d0f8 --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTAjaxExpansionTestPage.java @@ -0,0 +1,27 @@ +package er.ajax.mootools.example.components; + +import com.webobjects.appserver.WOActionResults; +import com.webobjects.appserver.WOContext; +import com.webobjects.appserver.WOResponse; + +import er.ajax.mootools.MTAjaxUtils; + +public class MTAjaxExpansionTestPage extends Main { + + public boolean _optionsVisible; + + public MTAjaxExpansionTestPage(WOContext context) { + super(context); + } + + public void appendToResponse(WOResponse response, WOContext context) { + super.appendToResponse(response, context); + MTAjaxUtils.addStylesheetResourceInHead(context, response, "app", "css/ToggleDetails.css"); + } + + public WOActionResults toggleOptions() { + _optionsVisible = !_optionsVisible; + return null; + } + +} \ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTStyledPopUpButtonTestPage.java b/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTStyledPopUpButtonTestPage.java new file mode 100644 index 00000000000..98d66c8636f --- /dev/null +++ b/Examples/Ajax/MooToolsExample/Sources/er/ajax/mootools/example/components/MTStyledPopUpButtonTestPage.java @@ -0,0 +1,30 @@ +package er.ajax.mootools.example.components; + +import com.webobjects.appserver.WOContext; +import com.webobjects.foundation.NSArray; +import com.webobjects.appserver.WOActionResults; + +import er.extensions.foundation.ERXStringUtilities; + +public class MTStyledPopUpButtonTestPage extends Main { + + public String _item; + public String _selectedItem; + + public MTStyledPopUpButtonTestPage(WOContext context) { + super(context); + String favFruit = context.request().stringFormValueForKey("FavFruit"); + if(ERXStringUtilities.stringIsNullOrEmpty(favFruit) == false && list().containsObject(favFruit)) { + _selectedItem = favFruit; + } + } + + public NSArray list() { + return new NSArray(new String[] {"Apple", "Banana", "Mango", "Orange", "Pineapple" }); + } + + public WOActionResults selectFruit() { + return null; + } + +} \ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/WebServerResources/css/ToggleDetails.css b/Examples/Ajax/MooToolsExample/WebServerResources/css/ToggleDetails.css new file mode 100644 index 00000000000..303864ee3c2 --- /dev/null +++ b/Examples/Ajax/MooToolsExample/WebServerResources/css/ToggleDetails.css @@ -0,0 +1,57 @@ +div.personInfo { + padding: 1em; + border: 3px solid rgb(220, 220, 220); + background-color: rgb(240, 240, 240); + -webkit-border-radius: 1em; + margin-bottom: 1em; +} + +h1 { + margin-bottom: 0.1em; + margin-top: 0em; +} + +h1 img { + margin-right: 8px; + border: 1px solid rgb(180, 180, 180); +} + +div.profile { + margin-left: 62px; +} + +div.profile > a { + text-decoration: none; + vertical-align: top; + color: rgb(140, 140, 140); +} + +div.profile > a img { + border: none; +} + +div.profile dl { + margin-left: 19px; +} + +div.profile dt { + text-transform: lowercase; + color: rgb(140, 140, 140); +} + +div.profile dd { + margin-bottom: 0.75em; +} + +a#profile2Link { + background-image: url(../img/triangleRight.gif); + background-repeat: no-repeat; + padding-left: 20px; + margin-left: 62px; + color: rgb(140, 140, 140); + text-decoration: none; +} + +a#profile2Link.expanded { + background-image: url(../img/triangleDown.gif); +} \ No newline at end of file diff --git a/Examples/Ajax/MooToolsExample/WebServerResources/img/avatar.png b/Examples/Ajax/MooToolsExample/WebServerResources/img/avatar.png new file mode 100644 index 00000000000..aaac8468d8e Binary files /dev/null and b/Examples/Ajax/MooToolsExample/WebServerResources/img/avatar.png differ diff --git a/Examples/Ajax/MooToolsExample/WebServerResources/img/avatar2.png b/Examples/Ajax/MooToolsExample/WebServerResources/img/avatar2.png new file mode 100644 index 00000000000..ab7e78dca02 Binary files /dev/null and b/Examples/Ajax/MooToolsExample/WebServerResources/img/avatar2.png differ diff --git a/Examples/Ajax/MooToolsExample/WebServerResources/img/triangleDown.gif b/Examples/Ajax/MooToolsExample/WebServerResources/img/triangleDown.gif new file mode 100644 index 00000000000..89af7776b4e Binary files /dev/null and b/Examples/Ajax/MooToolsExample/WebServerResources/img/triangleDown.gif differ diff --git a/Examples/Ajax/MooToolsExample/WebServerResources/img/triangleRight.gif b/Examples/Ajax/MooToolsExample/WebServerResources/img/triangleRight.gif new file mode 100644 index 00000000000..5213d3d3ed1 Binary files /dev/null and b/Examples/Ajax/MooToolsExample/WebServerResources/img/triangleRight.gif differ diff --git a/Frameworks/Ajax/MooTools/Components/MTAjaxAutoComplete.api b/Frameworks/Ajax/MooTools/Components/MTAjaxAutoComplete.api new file mode 100644 index 00000000000..ee10314e66c --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/MTAjaxAutoComplete.api @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Frameworks/Ajax/MooTools/Components/MTAjaxExpansion.api b/Frameworks/Ajax/MooTools/Components/MTAjaxExpansion.api new file mode 100644 index 00000000000..46096021d35 --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/MTAjaxExpansion.api @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Frameworks/Ajax/MooTools/Components/MTERAttachmentFlexibleUpload.api b/Frameworks/Ajax/MooTools/Components/MTERAttachmentFlexibleUpload.api new file mode 100644 index 00000000000..32740a12b9b --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/MTERAttachmentFlexibleUpload.api @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Frameworks/Ajax/MooTools/Components/MTStyledPopUpButton.api b/Frameworks/Ajax/MooTools/Components/MTStyledPopUpButton.api new file mode 100644 index 00000000000..70f673b75bc --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/MTStyledPopUpButton.api @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.html b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.html new file mode 100644 index 00000000000..60f39bdb958 --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + window.addEvent('domready', function() { + var div = $(''); + + document.getElementById('').appendChild(div); + + + document.getElementsByTagName('body')[0].appendChild(div); + + }); + + + + + + \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.wod b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.wod new file mode 100644 index 00000000000..d3b3099703f --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.wod @@ -0,0 +1,79 @@ +NotDisabled: WOConditional { + condition = ^disabled; + negate = true; +} + +Disabled: WOConditional { + condition = ^disabled; +} + +Content: WOComponentContent { +} + +ShowItem: WOConditional { + condition = true; +} + +ShowList : WOConditional { + condition = false; +} + +TextField: WOTextField { + autocomplete = "off"; + class = ^class; + id = fieldName; + disabled = ^disabled; + name = fieldName; + value = stringValue; + size= ^size; + onblur = ^onblur; + onchange = ^onchange; + onfocus = ^onfocus; + accesskey = ^accesskey; + tabindex = ^tabindex; + default = ^default; + style = ^style; + type = ^type; + results = ^results; +} + +HasIndicator : WOConditional { + condition = ^indicatorFilename; +} + +Indicator : WOImage { + id = indicatorName; + class = "autocomplete_indicator"; + framework = ^indicatorFramework; + filename = ^indicatorFilename; + style = "display: none"; +} + +ZIndexContainer : WOGenericContainer { + elementName = "div"; + id = zcontainerName; + style = "position: absolute; top: 0px; left: 0px; z-index: 1000;"; +} + +AutoCompleteContainer : WOGenericContainer { + elementName = "div"; + class = "auto_complete"; + id = divName; +} + +ZIndexContainerName: WOString { + value = zcontainerName; +} + +hasContainerId : WOConditional { + condition = ^containerId; +} + +containerId : WOString { + value = ^containerId; +} + +else : WOConditional { + condition = ^containerId; + negate = true; +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.woo b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.woo new file mode 100644 index 00000000000..a076a051a7e --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxAutoComplete.wo/MTAjaxAutoComplete.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.html b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.html new file mode 100644 index 00000000000..86c3e8b2402 --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.html @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.wod b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.wod new file mode 100644 index 00000000000..57490141221 --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.wod @@ -0,0 +1,55 @@ +AjaxUpdateContainer : MTAjaxUpdateContainer { + class = ^class; + id = id; + onRefreshComplete = onExpansionComplete; +} + +Content : ERXWOComponentContent { + +} + +EscapedLinkString : WOString { + value = jsEscapedString; +} + +Expanded : WOConditional { + condition = expanded; +} + +ExpandedValue : WOString { + value = expanded; +} + +HasEscapedLinkString : WOConditional { + condition = jsEscapedString.length; +} + +IsAjaxRequest : WOConditional { + condition = isAjaxRequest; +} + +LabelContent : ERXWOComponentContent { + templateName = "label"; +} + +LinkID : WOString { + value = linkID; +} + +ToggleLink : MTAjaxUpdateLink { + accesskey = ^accesskey; + action = toggle; + class = linkClass; + elementName = ^elementName; + id = linkID; + onComplete = ^onComplete; + onFailure = ^onFailure; + onLoading = ^onLoading; + onSuccess = ^onSuccess; + updateContainerID = id; +} + +ToggleLinkString : WOString { + escapeHTML = false; + value = string; +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.woo b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.woo new file mode 100644 index 00000000000..a076a051a7e --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTAjaxExpansion.wo/MTAjaxExpansion.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.html b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.html new file mode 100644 index 00000000000..3171b4d3249 --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.wod b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.wod new file mode 100644 index 00000000000..bae7d112afd --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.wod @@ -0,0 +1,27 @@ +AjaxFlexibleFileUpload : WOSwitchComponent { + WOComponentName = "MTAjaxFileUpload"; + filePath = filePath; + finalFilePath = finalFilePath; + keepTempFile = true; + succeededAction = uploadSucceeded; + allowCancel = ^allowCancel; + cancelLabel = ^cancelLabel; + canceledAction = ^canceledAction; + canceledFunction = ^canceledFunction; + cancelingText = ^cancelingText; + failedAction = ^failedAction; + failedFunction = ^failedFunction; + finishedAction = ^finishedAction; + finishedFunction = ^finishedFunction; + refreshTime = ^refreshTime; + startedFunction = ^startedFunction; + succeededFunction = ^succeededFunction; + autoSubmit = ^autoSubmit; + injectDefaultCSS = ^injectDefaultCSS; + selectFileButtonClass = ^selectFileButtonClass; + selectFileLabel = ^selectFileLabel; + cancelButtonClass = ^cancelButtonClass; + clearButtonClass = ^clearButtonClass; + id = ^id; + clearUploadProgressOnSuccess = ^clearUploadProgressOnSuccess; +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.woo b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.woo new file mode 100644 index 00000000000..a076a051a7e --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTERAttachmentFlexibleUpload.wo/MTERAttachmentFlexibleUpload.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.html b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.html new file mode 100644 index 00000000000..34c5a41fcc2 --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.html @@ -0,0 +1,9 @@ + + + + + + + + var = new FancySelect('', ); + \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.wod b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.wod new file mode 100644 index 00000000000..dd9a948b898 --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.wod @@ -0,0 +1,45 @@ +ID : WOString { + value = id; +} + +Options : AjaxOptions { + options = createAjaxOptions; +} + +SelectionPopUpButton : WOPopUpButton { + disabled = ^disabled; + displayString = ^displayString; + escapeHTML = ^escapeHTML; + id = id; + item = ^item; + list = ^list; + name = ^name; + noSelectionString = ^noSelectionString; + selection = ^selection; +} + +SelectionNonNullConditional : WOConditional { + condition = selectionIsDefined; +} + +SelectedValuePopUpButton : WOPopUpButton { + disabled = ^disabled; + displayString = ^displayString; + escapeHTML = ^escapeHTML; + id = id; + item = ^item; + list = ^list; + name = ^name; + noSelectionString = ^noSelectionString; + selectedValue = ^selectedValue; + value = ^value; +} + +SelectedValueNonNullConditional : WOConditional { + condition = selectedValueIsDefined; +} + +ScriptContainer : WOGenericContainer { + elementName = "script"; + type = "text/javascript"; +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.woo b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.woo new file mode 100644 index 00000000000..a076a051a7e --- /dev/null +++ b/Frameworks/Ajax/MooTools/Components/Nonlocalized.lproj/MTStyledPopUpButton.wo/MTStyledPopUpButton.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTAjaxAutoComplete.java b/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTAjaxAutoComplete.java new file mode 100644 index 00000000000..62699cf6603 --- /dev/null +++ b/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTAjaxAutoComplete.java @@ -0,0 +1,288 @@ +package er.ajax.mootools; + +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; + +import com.webobjects.appserver.WOActionResults; +import com.webobjects.appserver.WOContext; +import com.webobjects.appserver.WOElement; +import com.webobjects.appserver.WORequest; +import com.webobjects.appserver.WOResponse; +import com.webobjects.foundation.NSArray; +import com.webobjects.foundation.NSDictionary; +import com.webobjects.foundation.NSMutableArray; +import com.webobjects.foundation.NSMutableDictionary; + +import er.ajax.AjaxComponent; +import er.ajax.AjaxOption; +import er.ajax.AjaxOptions; +import er.ajax.AjaxUtils; +import er.extensions.foundation.ERXStringUtilities; +import er.extensions.foundation.ERXValueUtilities; + +public class MTAjaxAutoComplete extends AjaxComponent { + + public String divName; + public String fieldName; + public String indicatorName; + + public MTAjaxAutoComplete(WOContext context) { + super(context); + } + + @Override + protected void addRequiredWebResources(WOResponse res) { + // TODO Auto-generated method stub + MTAjaxUtils.addScriptResourceInHead(context(), res, "MooTools", MTAjaxUtils.MOOTOOLS_CORE_JS); + MTAjaxUtils.addScriptResourceInHead(context(), res, "MooTools", "scripts/plugins/autocomplete/AutoCompleter.js"); + } + + /** + * Overridden to set the IDs for the field and the div tag. + */ + public void awake() { + super.awake(); + divName = safeElementID() + "_div"; + fieldName = safeElementID() + "_field"; + indicatorName = safeElementID() + "_indicator"; + } + + public void sleep() { + divName = null; + fieldName = null; + indicatorName = null; + super.sleep(); + } + + /** + * Overridden because the component is stateless + */ + public boolean isStateless() { + return true; + } + + /** + * Overridden because the component does not synch with the bindings. + */ + public boolean synchronizesVariablesWithBindings() { + return false; + } + + public String indicator() { + String indicator = (String)valueForBinding("indicator"); + if (indicator == null && valueForBinding("indicatorFilename") != null) { + indicator = "'" + indicatorName + "'"; + } + return indicator; + } + + protected NSDictionary createAjaxOptions() { + NSMutableArray ajaxOptionsArray = new NSMutableArray(); + ajaxOptionsArray.addObject(new AjaxOption("tokens", AjaxOption.STRING_ARRAY)); + ajaxOptionsArray.addObject(new AjaxOption("frequency", AjaxOption.NUMBER)); + ajaxOptionsArray.addObject(new AjaxOption("minChars", AjaxOption.NUMBER)); + ajaxOptionsArray.addObject(new AjaxOption("indicator", indicator(), AjaxOption.SCRIPT)); + ajaxOptionsArray.addObject(new AjaxOption("updateElement", AjaxOption.SCRIPT)); + ajaxOptionsArray.addObject(new AjaxOption("afterUpdateElement", AjaxOption.SCRIPT)); + ajaxOptionsArray.addObject(new AjaxOption("onShow", AjaxOption.SCRIPT)); + ajaxOptionsArray.addObject(new AjaxOption("fullSearch", AjaxOption.BOOLEAN)); + ajaxOptionsArray.addObject(new AjaxOption("partialSearch", AjaxOption.BOOLEAN)); + ajaxOptionsArray.addObject(new AjaxOption("defaultValue", AjaxOption.STRING)); + ajaxOptionsArray.addObject(new AjaxOption("select", AjaxOption.STRING)); + ajaxOptionsArray.addObject(new AjaxOption("autoSelect", AjaxOption.BOOLEAN)); + ajaxOptionsArray.addObject(new AjaxOption("choices", AjaxOption.NUMBER)); + ajaxOptionsArray.addObject(new AjaxOption("partialChars", AjaxOption.NUMBER)); + ajaxOptionsArray.addObject(new AjaxOption("ignoreCase", AjaxOption.BOOLEAN)); + ajaxOptionsArray.addObject(new AjaxOption("activateOnFocus", AjaxOption.BOOLEAN)); + NSMutableDictionary options = AjaxOption.createAjaxOptionsDictionary(ajaxOptionsArray, this); + return options; + } + + /** + * Overridden to add the initialization javascript for the auto completer. + */ + public void appendToResponse(WOResponse res, WOContext ctx) { + super.appendToResponse(res, ctx); + boolean isDisabled = hasBinding("disabled") && ((Boolean) valueForBinding("disabled")).booleanValue(); + if ( !isDisabled ) { + boolean isLocal = hasBinding("isLocal") && ((Boolean) valueForBinding("isLocal")).booleanValue(); + if (isLocal) { + StringBuffer str = new StringBuffer(); + boolean isLocalSharedList = hasBinding("isLocalSharedList") && ((Boolean) valueForBinding("isLocalSharedList")).booleanValue(); + String listJS = null; + if (isLocalSharedList) { + String varName = (String) valueForBinding("localSharedVarName"); + NSMutableDictionary userInfo = AjaxUtils.mutableUserInfo(res); + if (userInfo.objectForKey(varName) == null) { + String ljs = listeJS(); + AjaxUtils.addScriptCodeInHead(res, ctx, "var " + varName + " = " + ljs + ";"); + userInfo.setObjectForKey(ljs, varName); + } + listJS = varName; + } else { + listJS = listeJS(); + } + str.append("\n"); + res.appendContentString(String.valueOf(str)); + } else { + String actionUrl = AjaxUtils.ajaxComponentActionUrl(ctx); + AjaxUtils.appendScriptHeader(res); + res.appendContentString("new Request.Autocompleter('"+fieldName+"', '"+divName+"', '"+actionUrl+"', "); + AjaxOptions.appendToResponse(createAjaxOptions(), res, ctx); + res.appendContentString(");"); + AjaxUtils.appendScriptFooter(res); + } + } + } + + String listeJS() { + StringBuffer str = new StringBuffer(); + str.append("new Array("); + NSArray list = (NSArray) valueForBinding("list"); + int max = list.count(); + String cnt = ""; + boolean hasItem = hasBinding("item"); + for (int i = 0; i < max; i++) { + Object ds = list.objectAtIndex(i); + if (i > 0) { + str.append(","); + } + str.append("\n\""); + if (hasItem) { + setValueForBinding(ds, "item"); + } + Object displayValue = valueForBinding("displayString", valueForBinding("item", ds)); + str.append(displayValue.toString()); + // TODO: We should escape the javascript string delimiter (") to keep the javascript interpreter happy. + //str.append(displayValue.toString().replaceAll("\"", "\\\\\\\\\"")); // doesn't work + str.append(cnt); + str.append("\""); + } + str.append(")"); + return String.valueOf(str); + } + + public String stringValue() { + String strValue = null; + if (hasBinding("selection")) { + Object selection = valueForBinding("selection"); + if (selection != null) { + if (hasBinding("displayString")) { + setValueForBinding(selection, "item"); + strValue = displayStringForValue(valueForBinding("value")); + } + else { + strValue = String.valueOf(selection); + } + } + else + strValue = (String) valueForBinding("value"); + } + else if (hasBinding("value")) { + strValue = (String) valueForBinding("value"); + } + return strValue; + } + + protected String displayStringForValue(Object value) { + Object displayValue = valueForBinding("displayString", valueForBinding("item", value)); + String displayString = displayValue == null ? null : displayValue.toString(); + return displayString; + } + + protected int maxItems() { + int maxItems = ERXValueUtilities.intValueWithDefault(valueForBinding("maxItems"), 50); + return maxItems; + } + + public void setStringValue(String strValue) { + if (hasBinding("selection")) { + Object selection = null; + if (strValue != null) { + NSArray values = (NSArray) valueForBinding("list"); + int maxItems = maxItems(); + int itemsCount = 0; + for(Enumeration e = values.objectEnumerator(); e.hasMoreElements() && itemsCount++ < maxItems;) { + Object value = e.nextElement(); + setValueForBinding(value, "item"); + String displayString = displayStringForValue(value); + if (ERXStringUtilities.stringEqualsString(displayString, strValue)) { + selection = value; + break; + } + } + } + setValueForBinding(selection, "selection"); + } + setValueForBinding(strValue, "value"); + } + + public void takeValuesFromRequest(WORequest request, WOContext context) { + super.takeValuesFromRequest(request, context); + } + + protected void appendItemToResponse(Object value, WOElement child, boolean hasItem, WOResponse response, WOContext context) { + response.appendContentString("
  • "); + if(hasItem && child != null) { + setValueForBinding(value, "item"); + context._setCurrentComponent(parent()); + child.appendToResponse(response, context); + context._setCurrentComponent(this); + } else { + if(hasItem) { + setValueForBinding(value, "item"); + } + response.appendContentString(displayStringForValue(value)); + } + response.appendContentString("
  • "); + } + + /** + * Handles the Ajax request. Checks for the form value in the edit field, + * pushes it up to the parent and pulls the "list" binding. The parent is + * responsible for returning a list with some items that match the current value. + */ + public WOActionResults handleRequest(WORequest request, WOContext context) { + // String inputString = request.contentString(); + + String fieldValue = context.request().stringFormValueForKey(fieldName); + setValueForBinding(fieldValue, "value"); + + WOResponse response = AjaxUtils.createResponse(request, context); + response.appendContentString("
      "); + + int maxItems = maxItems(); + int itemsCount = 0; + Object values = valueForBinding("list"); + WOElement child = _childTemplate(); + boolean hasItem = hasBinding("item"); + if (values instanceof NSArray) { + for(Enumeration valueEnum = ((NSArray)values).objectEnumerator(); valueEnum.hasMoreElements() && itemsCount++ < maxItems;) { + appendItemToResponse(valueEnum.nextElement(), child, hasItem, response, context); + } + } + else if (values instanceof List) { + for(Iterator iter = ((List)values).iterator(); iter.hasNext() && itemsCount++ < maxItems;) { + appendItemToResponse(iter.next(), child, hasItem, response, context); + } + } + response.appendContentString("
    "); + return response; + + } + + public String zcontainerName() { + return "ZContainer" + divName; + } + +} diff --git a/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTAjaxExpansion.java b/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTAjaxExpansion.java new file mode 100644 index 00000000000..8a11090983e --- /dev/null +++ b/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTAjaxExpansion.java @@ -0,0 +1,19 @@ +package er.ajax.mootools; + +import com.webobjects.appserver.WOContext; +import com.webobjects.appserver.WOResponse; + +import er.ajax.AjaxExpansion; + +public class MTAjaxExpansion extends AjaxExpansion { + + public MTAjaxExpansion(WOContext context) { + super(context); + } + + protected void addRequiredWebResources(WOResponse response) { + MTAjaxUtils.addScriptResourceInHead(context(), response, "MooTools", MTAjaxUtils.MOOTOOLS_CORE_JS); + MTAjaxUtils.addScriptResourceInHead(context(), response, "MooTools", MTAjaxUtils.MOOTOOLS_WONDER_JS); + } + +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTERAttachmentFlexibleUpload.java b/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTERAttachmentFlexibleUpload.java new file mode 100644 index 00000000000..15ba677b74d --- /dev/null +++ b/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTERAttachmentFlexibleUpload.java @@ -0,0 +1,10 @@ +package er.ajax.mootools; + +import com.webobjects.appserver.WOContext; +import er.attachment.components.ERAttachmentFlexibleUpload; + +public class MTERAttachmentFlexibleUpload extends ERAttachmentFlexibleUpload { + public MTERAttachmentFlexibleUpload(WOContext context) { + super(context); + } +} \ No newline at end of file diff --git a/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTStyledPopUpButton.java b/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTStyledPopUpButton.java new file mode 100644 index 00000000000..12c47e8165d --- /dev/null +++ b/Frameworks/Ajax/MooTools/Sources/er/ajax/mootools/MTStyledPopUpButton.java @@ -0,0 +1,145 @@ +package er.ajax.mootools; + +import com.webobjects.appserver.WOContext; +import com.webobjects.appserver.WOResponse; +import com.webobjects.foundation.NSArray; +import com.webobjects.foundation.NSDictionary; +import com.webobjects.foundation.NSMutableArray; +import com.webobjects.foundation.NSMutableDictionary; + +import er.ajax.AjaxOption; +import er.extensions.appserver.ERXWOContext; +import er.extensions.components.ERXStatelessComponent; + + +/* + * @binding id - the identifier for the select button and the JavaScript variable. + * @binding useDefaultCss - If TRUE (default) it will load the default stylesheet. + * @binding showText - If TRUE (default) keeps text in the dropdown menu. + * @binding Unsupported operation showImages - If TRUE (default) show images in the dropdown menu. + * TODO figure out how to use the data images drop down. + * @binding className: A class name for CSS styling, default 'fancy-select'. + * @binding autoHide: If TRUE auto-hide the dropdown menu when user clicks outside. + * @binding autoScrollWindow: If TRUE auto-scroll browser window when FancySelect is out of viewport. + * @binding animateFade: If TRUE (default) animate the dropdown menu appearance. + * @binding fx: An object for additional Fx options (default {'duration': 'short'}). + * @binding onShow: The dropdown menu appears. + * @binding onHide: The dropdown menu disappears. + * @binding onAttach: FancySelect just replaced the DOM element is back. + * @binding list: Array of objects from which the WOPopUpButton derives its values. + * @binding item: Identifier for the elements of the list. For example, aCollege could represent an object in a colleges array. + * @binding displayString: Value to display in the selection list; for example, aCollege.name for each college object in the list. + * @binding value: For each OPTION tag within the selection, this is the ÒvalueÓ attribute (that is,