Re: svn commit: r675103 - in /ofbiz/trunk/framework: example/widget/example/ images/webapp/images/ images/webapp/images/prototypejs/ widget/src/org/ofbiz/widget/html/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r675103 - in /ofbiz/trunk/framework: example/widget/example/ images/webapp/images/ images/webapp/images/prototypejs/ widget/src/org/ofbiz/widget/html/

Adrian Crum
Are you sure you want to modify a third party library?

-Adrian

[hidden email] wrote:

> Author: apatel
> Date: Tue Jul  8 23:15:23 2008
> New Revision: 675103
>
> URL: http://svn.apache.org/viewvc?rev=675103&view=rev
> Log:
> enhancements to the Autocompleter integration with form widget dropdown.
>
> Modified:
>     ofbiz/trunk/framework/example/widget/example/ExampleForms.xml
>     ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml
>     ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js
>     ofbiz/trunk/framework/images/webapp/images/selectall.js
>     ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>
> Modified: ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js?rev=675103&r1=675102&r2=675103&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js (original)
> +++ ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js Tue Jul  8 23:15:23 2008
> @@ -407,9 +407,9 @@
>  // you support them.
>  
>  Autocompleter.Local = Class.create(Autocompleter.Base, {
> -  initialize: function(element, update, array, options) {
> +  initialize: function(element, update, data, options) {
>      this.baseInitialize(element, update, options);
> -    this.options.array = array;
> +    this.options.data = data;
>    },
>  
>    getUpdatedChoices: function() {
> @@ -429,38 +429,75 @@
>          var entry     = instance.getToken();
>          var count     = 0;
>  
> -        for (var i = 0; i < instance.options.array.length &&  
> -          ret.length < instance.options.choices ; i++) {
> -
> -          var elem = instance.options.array[i];
> -          var foundPos = instance.options.ignoreCase ?
> -            elem.toLowerCase().indexOf(entry.toLowerCase()) :
> -            elem.indexOf(entry);
> -
> -          while (foundPos != -1) {
> -            if (foundPos == 0 && elem.length != entry.length) {
> -              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
> -                elem.substr(entry.length) + "</li>");
> -              break;
> -            } else if (entry.length >= instance.options.partialChars &&
> -              instance.options.partialSearch && foundPos != -1) {
> -              if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
> -                partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
> -                  elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
> -                  foundPos + entry.length) + "</li>");
> +        if (Object.isHash(instance.options.data)) {
> +          var keys = [];
> +          keys = instance.options.data.keys();
> +          for (var i = 0; i < keys.length &&  
> +            ret.length < instance.options.choices ; i++) {
> +
> +            var elem = instance.options.data.get(keys[i]);
> +            var foundPos = instance.options.ignoreCase ?
> +              elem.toLowerCase().indexOf(entry.toLowerCase()) :
> +              elem.indexOf(entry);
> +
> +            while (foundPos != -1) {
> +              if (foundPos == 0 && elem.length != entry.length) {
> +                ret.push("<li id=" + '"' + keys[i] + '"' + "><strong>" + elem.substr(0, entry.length) + "</strong>" +
> +                  elem.substr(entry.length) + "</li>");
>                  break;
> +              } else if (entry.length >= instance.options.partialChars &&
> +                instance.options.partialSearch && foundPos != -1) {
> +                if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
> +                  partial.push("<li id=" + '"' + keys[i] + '"' + ">" + elem.substr(0, foundPos) + "<strong>" +
> +                    elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
> +                    foundPos + entry.length) + "</li>");
> +                  break;
> +                }
>                }
> +
> +              foundPos = instance.options.ignoreCase ?
> +                elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
> +                elem.indexOf(entry, foundPos + 1);
> +
>              }
> +          }
> +          if (partial.length)
> +            ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
> +          return "<ul>" + ret.join('') + "</ul>";
> +        } else {
> +          for (var i = 0; i < instance.options.data.length &&  
> +            ret.length < instance.options.choices ; i++) {
> +
> +            var elem = instance.options.data[i];
> +            var foundPos = instance.options.ignoreCase ?
> +              elem.toLowerCase().indexOf(entry.toLowerCase()) :
> +              elem.indexOf(entry);
> +
> +            while (foundPos != -1) {
> +              if (foundPos == 0 && elem.length != entry.length) {
> +                ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
> +                  elem.substr(entry.length) + "</li>");
> +                break;
> +              } else if (entry.length >= instance.options.partialChars &&
> +                instance.options.partialSearch && foundPos != -1) {
> +                if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
> +                  partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
> +                    elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
> +                    foundPos + entry.length) + "</li>");
> +                  break;
> +                }
> +              }
>  
> -            foundPos = instance.options.ignoreCase ?
> -              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
> -              elem.indexOf(entry, foundPos + 1);
> +              foundPos = instance.options.ignoreCase ?
> +                elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
> +                elem.indexOf(entry, foundPos + 1);
>  
> +            }
>            }
> +          if (partial.length)
> +            ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
> +          return "<ul>" + ret.join('') + "</ul>";
>          }
> -        if (partial.length)
> -          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
> -        return "<ul>" + ret.join('') + "</ul>";
>        }
>      }, options || { });
>    }
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r675103 - in /ofbiz/trunk/framework: example/widget/example/ images/webapp/images/ images/webapp/images/prototypejs/ widget/src/org/ofbiz/widget/html/

Mridul Pathak-2
Adrian,
    I am working on to get these changes in the script.aculo.us library as
well.

On Wed, Jul 9, 2008 at 8:27 PM, Adrian Crum <[hidden email]> wrote:

> Are you sure you want to modify a third party library?
>
> -Adrian
>
> [hidden email] wrote:
>
>> Author: apatel
>> Date: Tue Jul  8 23:15:23 2008
>> New Revision: 675103
>>
>> URL: http://svn.apache.org/viewvc?rev=675103&view=rev
>> Log:
>> enhancements to the Autocompleter integration with form widget dropdown.
>>
>> Modified:
>>    ofbiz/trunk/framework/example/widget/example/ExampleForms.xml
>>    ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml
>>    ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js
>>    ofbiz/trunk/framework/images/webapp/images/selectall.js
>>
>>  ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>
>> Modified:
>> ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js?rev=675103&r1=675102&r2=675103&view=diff
>>
>> ==============================================================================
>> --- ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js
>> (original)
>> +++ ofbiz/trunk/framework/images/webapp/images/prototypejs/controls.js Tue
>> Jul  8 23:15:23 2008
>> @@ -407,9 +407,9 @@
>>  // you support them.
>>   Autocompleter.Local = Class.create(Autocompleter.Base, {
>> -  initialize: function(element, update, array, options) {
>> +  initialize: function(element, update, data, options) {
>>     this.baseInitialize(element, update, options);
>> -    this.options.array = array;
>> +    this.options.data = data;
>>   },
>>     getUpdatedChoices: function() {
>> @@ -429,38 +429,75 @@
>>         var entry     = instance.getToken();
>>         var count     = 0;
>>  -        for (var i = 0; i < instance.options.array.length &&  -
>>  ret.length < instance.options.choices ; i++) { -
>> -          var elem = instance.options.array[i];
>> -          var foundPos = instance.options.ignoreCase ? -
>>  elem.toLowerCase().indexOf(entry.toLowerCase()) : -
>>  elem.indexOf(entry);
>> -
>> -          while (foundPos != -1) {
>> -            if (foundPos == 0 && elem.length != entry.length) { -
>>      ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
>> -                elem.substr(entry.length) + "</li>");
>> -              break;
>> -            } else if (entry.length >= instance.options.partialChars && -
>>              instance.options.partialSearch && foundPos != -1) {
>> -              if (instance.options.fullSearch ||
>> /\s/.test(elem.substr(foundPos-1,1))) {
>> -                partial.push("<li>" + elem.substr(0, foundPos) +
>> "<strong>" +
>> -                  elem.substr(foundPos, entry.length) + "</strong>" +
>> elem.substr(
>> -                  foundPos + entry.length) + "</li>");
>> +        if (Object.isHash(instance.options.data)) {
>> +          var keys = [];
>> +          keys = instance.options.data.keys();
>> +          for (var i = 0; i < keys.length &&  +            ret.length <
>> instance.options.choices ; i++) { +
>> +            var elem = instance.options.data.get(keys[i]);
>> +            var foundPos = instance.options.ignoreCase ? +
>>  elem.toLowerCase().indexOf(entry.toLowerCase()) : +
>>  elem.indexOf(entry);
>> +
>> +            while (foundPos != -1) {
>> +              if (foundPos == 0 && elem.length != entry.length) { +
>>          ret.push("<li id=" + '"' + keys[i] + '"' + "><strong>" +
>> elem.substr(0, entry.length) + "</strong>" + +
>>  elem.substr(entry.length) + "</li>");
>>                 break;
>> +              } else if (entry.length >= instance.options.partialChars &&
>> +                instance.options.partialSearch && foundPos != -1) {
>> +                if (instance.options.fullSearch ||
>> /\s/.test(elem.substr(foundPos-1,1))) {
>> +                  partial.push("<li id=" + '"' + keys[i] + '"' + ">" +
>> elem.substr(0, foundPos) + "<strong>" +
>> +                    elem.substr(foundPos, entry.length) + "</strong>" +
>> elem.substr(
>> +                    foundPos + entry.length) + "</li>");
>> +                  break;
>> +                }
>>               }
>> +
>> +              foundPos = instance.options.ignoreCase ? +
>>  elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : +
>>      elem.indexOf(entry, foundPos + 1);
>> +
>>             }
>> +          }
>> +          if (partial.length)
>> +            ret = ret.concat(partial.slice(0, instance.options.choices -
>> ret.length))
>> +          return "<ul>" + ret.join('') + "</ul>";
>> +        } else {
>> +          for (var i = 0; i < instance.options.data.length &&  +
>>    ret.length < instance.options.choices ; i++) { +
>> +            var elem = instance.options.data[i];
>> +            var foundPos = instance.options.ignoreCase ? +
>>  elem.toLowerCase().indexOf(entry.toLowerCase()) : +
>>  elem.indexOf(entry);
>> +
>> +            while (foundPos != -1) {
>> +              if (foundPos == 0 && elem.length != entry.length) { +
>>          ret.push("<li><strong>" + elem.substr(0, entry.length) +
>> "</strong>" + +                  elem.substr(entry.length) + "</li>");
>> +                break;
>> +              } else if (entry.length >= instance.options.partialChars &&
>> +                instance.options.partialSearch && foundPos != -1) {
>> +                if (instance.options.fullSearch ||
>> /\s/.test(elem.substr(foundPos-1,1))) {
>> +                  partial.push("<li>" + elem.substr(0, foundPos) +
>> "<strong>" +
>> +                    elem.substr(foundPos, entry.length) + "</strong>" +
>> elem.substr(
>> +                    foundPos + entry.length) + "</li>");
>> +                  break;
>> +                }
>> +              }
>>  -            foundPos = instance.options.ignoreCase ? -
>>  elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : -
>>    elem.indexOf(entry, foundPos + 1);
>> +              foundPos = instance.options.ignoreCase ? +
>>  elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : +
>>      elem.indexOf(entry, foundPos + 1);
>>  +            }
>>           }
>> +          if (partial.length)
>> +            ret = ret.concat(partial.slice(0, instance.options.choices -
>> ret.length))
>> +          return "<ul>" + ret.join('') + "</ul>";
>>         }
>> -        if (partial.length)
>> -          ret = ret.concat(partial.slice(0, instance.options.choices -
>> ret.length))
>> -        return "<ul>" + ret.join('') + "</ul>";
>>       }
>>     }, options || { });
>>   }
>>
>


--
Thanks & Regards
Mridul Pathak
Hotwax Media
http://www.hotwaxmedia.com
[hidden email]