diff --git a/examples/widgetapp/application.e b/draft/library/wsf_js_widget/examples/demo/application.e similarity index 100% rename from examples/widgetapp/application.e rename to draft/library/wsf_js_widget/examples/demo/application.e diff --git a/examples/widgetapp/assets/bootstrap-datepicker.js b/draft/library/wsf_js_widget/examples/demo/assets/bootstrap-datepicker.js similarity index 100% rename from examples/widgetapp/assets/bootstrap-datepicker.js rename to draft/library/wsf_js_widget/examples/demo/assets/bootstrap-datepicker.js diff --git a/examples/widgetapp/assets/bootstrap-datetimepicker.css b/draft/library/wsf_js_widget/examples/demo/assets/bootstrap-datetimepicker.css similarity index 100% rename from examples/widgetapp/assets/bootstrap-datetimepicker.css rename to draft/library/wsf_js_widget/examples/demo/assets/bootstrap-datetimepicker.css diff --git a/examples/widgetapp/assets/bootstrap-datetimepicker.js b/draft/library/wsf_js_widget/examples/demo/assets/bootstrap-datetimepicker.js similarity index 100% rename from examples/widgetapp/assets/bootstrap-datetimepicker.js rename to draft/library/wsf_js_widget/examples/demo/assets/bootstrap-datetimepicker.js diff --git a/examples/widgetapp/assets/bootstrap.min.css b/draft/library/wsf_js_widget/examples/demo/assets/bootstrap.min.css similarity index 100% rename from examples/widgetapp/assets/bootstrap.min.css rename to draft/library/wsf_js_widget/examples/demo/assets/bootstrap.min.css diff --git a/examples/widgetapp/assets/bootstrap.min.js b/draft/library/wsf_js_widget/examples/demo/assets/bootstrap.min.js similarity index 100% rename from examples/widgetapp/assets/bootstrap.min.js rename to draft/library/wsf_js_widget/examples/demo/assets/bootstrap.min.js diff --git a/examples/widgetapp/assets/codemirror/codemirror.css b/draft/library/wsf_js_widget/examples/demo/assets/codemirror/codemirror.css similarity index 100% rename from examples/widgetapp/assets/codemirror/codemirror.css rename to draft/library/wsf_js_widget/examples/demo/assets/codemirror/codemirror.css diff --git a/examples/widgetapp/assets/codemirror/codemirror.js b/draft/library/wsf_js_widget/examples/demo/assets/codemirror/codemirror.js similarity index 100% rename from examples/widgetapp/assets/codemirror/codemirror.js rename to draft/library/wsf_js_widget/examples/demo/assets/codemirror/codemirror.js diff --git a/examples/widgetapp/assets/codemirror/eiffel.js b/draft/library/wsf_js_widget/examples/demo/assets/codemirror/eiffel.js similarity index 100% rename from examples/widgetapp/assets/codemirror/eiffel.js rename to draft/library/wsf_js_widget/examples/demo/assets/codemirror/eiffel.js diff --git a/examples/widgetapp/assets/codemirror/estudio.css b/draft/library/wsf_js_widget/examples/demo/assets/codemirror/estudio.css similarity index 100% rename from examples/widgetapp/assets/codemirror/estudio.css rename to draft/library/wsf_js_widget/examples/demo/assets/codemirror/estudio.css diff --git a/examples/widgetapp/assets/datepicker.css b/draft/library/wsf_js_widget/examples/demo/assets/datepicker.css similarity index 100% rename from examples/widgetapp/assets/datepicker.css rename to draft/library/wsf_js_widget/examples/demo/assets/datepicker.css diff --git a/examples/widgetapp/assets/glyphicons-halflings-regular.eot b/draft/library/wsf_js_widget/examples/demo/assets/glyphicons-halflings-regular.eot similarity index 100% rename from examples/widgetapp/assets/glyphicons-halflings-regular.eot rename to draft/library/wsf_js_widget/examples/demo/assets/glyphicons-halflings-regular.eot diff --git a/examples/widgetapp/assets/glyphicons-halflings-regular.svg b/draft/library/wsf_js_widget/examples/demo/assets/glyphicons-halflings-regular.svg similarity index 100% rename from examples/widgetapp/assets/glyphicons-halflings-regular.svg rename to draft/library/wsf_js_widget/examples/demo/assets/glyphicons-halflings-regular.svg diff --git a/examples/widgetapp/assets/glyphicons-halflings-regular.ttf b/draft/library/wsf_js_widget/examples/demo/assets/glyphicons-halflings-regular.ttf similarity index 100% rename from examples/widgetapp/assets/glyphicons-halflings-regular.ttf rename to draft/library/wsf_js_widget/examples/demo/assets/glyphicons-halflings-regular.ttf diff --git a/examples/widgetapp/assets/glyphicons-halflings-regular.woff b/draft/library/wsf_js_widget/examples/demo/assets/glyphicons-halflings-regular.woff similarity index 100% rename from examples/widgetapp/assets/glyphicons-halflings-regular.woff rename to draft/library/wsf_js_widget/examples/demo/assets/glyphicons-halflings-regular.woff diff --git a/examples/widgetapp/assets/jquery.min.js b/draft/library/wsf_js_widget/examples/demo/assets/jquery.min.js similarity index 100% rename from examples/widgetapp/assets/jquery.min.js rename to draft/library/wsf_js_widget/examples/demo/assets/jquery.min.js diff --git a/examples/widgetapp/assets/typeahead.min.js b/draft/library/wsf_js_widget/examples/demo/assets/typeahead.min.js similarity index 100% rename from examples/widgetapp/assets/typeahead.min.js rename to draft/library/wsf_js_widget/examples/demo/assets/typeahead.min.js diff --git a/examples/widgetapp/assets/widget.coffee b/draft/library/wsf_js_widget/examples/demo/assets/widget.coffee similarity index 100% rename from examples/widgetapp/assets/widget.coffee rename to draft/library/wsf_js_widget/examples/demo/assets/widget.coffee diff --git a/examples/widgetapp/assets/widget.css b/draft/library/wsf_js_widget/examples/demo/assets/widget.css similarity index 100% rename from examples/widgetapp/assets/widget.css rename to draft/library/wsf_js_widget/examples/demo/assets/widget.css diff --git a/examples/widgetapp/assets/widget.js b/draft/library/wsf_js_widget/examples/demo/assets/widget.js similarity index 100% rename from examples/widgetapp/assets/widget.js rename to draft/library/wsf_js_widget/examples/demo/assets/widget.js diff --git a/examples/widgetapp/autocompletion/contact_autocompletion.e b/draft/library/wsf_js_widget/examples/demo/autocompletion/contact_autocompletion.e similarity index 100% rename from examples/widgetapp/autocompletion/contact_autocompletion.e rename to draft/library/wsf_js_widget/examples/demo/autocompletion/contact_autocompletion.e diff --git a/draft/library/wsf_js_widget/examples/demo/autocompletion/flag_autocompletion.e b/draft/library/wsf_js_widget/examples/demo/autocompletion/flag_autocompletion.e new file mode 100644 index 00000000..a79596d0 --- /dev/null +++ b/draft/library/wsf_js_widget/examples/demo/autocompletion/flag_autocompletion.e @@ -0,0 +1,154 @@ +note + description: "Summary description for {FLAG_AUTOCOMPLETION}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + FLAG_AUTOCOMPLETION + +inherit + + WSF_AUTOCOMPLETION + +create + make + +feature {NONE} -- Initialization + + make + -- Initialize + do + template := " {{=value}}"; + end + +feature -- Implementation + + autocompletion (input: STRING_32): JSON_ARRAY + -- Implementation + local + list: ITERABLE [TUPLE [short: READABLE_STRING_8; name: READABLE_STRING_32]] + o: JSON_OBJECT + do + list := <<["AF", {STRING_32} "Afghanistan"], ["AX", {STRING_32} "Åland Islands"], ["AL", {STRING_32} "Albania"], + ["DZ", {STRING_32} "Algeria"], ["AS", {STRING_32} "American Samoa"], + ["AD", {STRING_32} "Andorra"], ["AO", {STRING_32} "Angola"], ["AI", {STRING_32} "Anguilla"], + ["AQ", {STRING_32} "Antarctica"], ["AG", {STRING_32} "Antigua and Barbuda"], + ["AR", {STRING_32} "Argentina"], ["AM", {STRING_32} "Armenia"], ["AW", {STRING_32} "Aruba"], + ["AU", {STRING_32} "Australia"], ["AT", {STRING_32} "Austria"], ["AZ", {STRING_32} "Azerbaijan"], + ["BS", {STRING_32} "Bahamas"], ["BH", {STRING_32} "Bahrain"], ["BD", {STRING_32} "Bangladesh"], + ["BB", {STRING_32} "Barbados"], ["BY", {STRING_32} "Belarus"], ["BE", {STRING_32} "Belgium"], + ["BZ", {STRING_32} "Belize"], ["BJ", {STRING_32} "Benin"], ["BM", {STRING_32} "Bermuda"], + ["BT", {STRING_32} "Bhutan"], ["BO", {STRING_32} "Bolivia, Plurinational State of"], + ["BQ", {STRING_32} "Bonaire, Sint Eustatius and Saba"], ["BA", {STRING_32} "Bosnia and Herzegovina"], + ["BW", {STRING_32} "Botswana"], ["BV", {STRING_32} "Bouvet Island"], + ["BR", {STRING_32} "Brazil"], ["IO", {STRING_32} "British Indian Ocean Territory"], + ["BN", {STRING_32} "Brunei Darussalam"], ["BG", {STRING_32} "Bulgaria"], + ["BF", {STRING_32} "Burkina Faso"], ["BI", {STRING_32} "Burundi"], ["KH", {STRING_32} "Cambodia"], + ["CM", {STRING_32} "Cameroon"], ["CA", {STRING_32} "Canada"], ["CV", {STRING_32} "Cape Verde"], + ["KY", {STRING_32} "Cayman Islands"], ["CF", {STRING_32} "Central African Republic"], + ["TD", {STRING_32} "Chad"], ["CL", {STRING_32} "Chile"], ["CN", {STRING_32} "China"], + ["CX", {STRING_32} "Christmas Island"], ["CC", {STRING_32} "Cocos (Keeling) Islands"], + ["CO", {STRING_32} "Colombia"], ["KM", {STRING_32} "Comoros"], ["CG", {STRING_32} "Congo"], + ["CD", {STRING_32} "Congo, the Democratic Republic of the"], ["CK", {STRING_32} "Cook Islands"], + ["CR", {STRING_32} "Costa Rica"], ["CI", {STRING_32} "Côte d'Ivoire"], + ["HR", {STRING_32} "Croatia"], ["CU", {STRING_32} "Cuba"], ["CW", {STRING_32} "Curaçao"], + ["CY", {STRING_32} "Cyprus"], ["CZ", {STRING_32} "Czech Republic"], ["DK", {STRING_32} "Denmark"], + ["DJ", {STRING_32} "Djibouti"], ["DM", {STRING_32} "Dominica"], ["DO", {STRING_32} "Dominican Republic"], + ["EC", {STRING_32} "Ecuador"], ["EG", {STRING_32} "Egypt"], ["SV", {STRING_32} "El Salvador"], + ["GQ", {STRING_32} "Equatorial Guinea"], ["ER", {STRING_32} "Eritrea"], ["EE", {STRING_32} "Estonia"], + ["ET", {STRING_32} "Ethiopia"], ["FK", {STRING_32} "Falkland Islands (Malvinas)"], + ["FO", {STRING_32} "Faroe Islands"], ["FJ", {STRING_32} "Fiji"], ["FI", {STRING_32} "Finland"], + ["FR", {STRING_32} "France"], ["GF", {STRING_32} "French Guiana"], + ["PF", {STRING_32} "French Polynesia"], ["TF", {STRING_32} "French Southern Territories"], + ["GA", {STRING_32} "Gabon"], ["GM", {STRING_32} "Gambia"], ["GE", {STRING_32} "Georgia"], + ["DE", {STRING_32} "Germany"], ["GH", {STRING_32} "Ghana"], ["GI", {STRING_32} "Gibraltar"], + ["GR", {STRING_32} "Greece"], ["GL", {STRING_32} "Greenland"], ["GD", {STRING_32} "Grenada"], + ["GP", {STRING_32} "Guadeloupe"], ["GU", {STRING_32} "Guam"], ["GT", {STRING_32} "Guatemala"], + ["GG", {STRING_32} "Guernsey"], ["GN", {STRING_32} "Guinea"], ["GW", {STRING_32} "Guinea-Bissau"], + ["GY", {STRING_32} "Guyana"], ["HT", {STRING_32} "Haiti"], ["HM", {STRING_32} "Heard Island and McDonald Islands"], + ["VA", {STRING_32} "Holy See (Vatican City State)"], + ["HN", {STRING_32} "Honduras"], ["HK", {STRING_32} "Hong Kong"], ["HU", {STRING_32} "Hungary"], + ["IS", {STRING_32} "Iceland"], ["IN", {STRING_32} "India"], ["ID", {STRING_32} "Indonesia"], + ["IR", {STRING_32} "Iran, Islamic Republic of"], ["IQ", {STRING_32} "Iraq"], ["IE", {STRING_32} "Ireland"], + ["IM", {STRING_32} "Isle of Man"], ["IL", {STRING_32} "Israel"], + ["IT", {STRING_32} "Italy"], ["JM", {STRING_32} "Jamaica"], ["JP", {STRING_32} "Japan"], ["JE", {STRING_32} "Jersey"], + ["JO", {STRING_32} "Jordan"], ["KZ", {STRING_32} "Kazakhstan"], + ["KE", {STRING_32} "Kenya"], ["KI", {STRING_32} "Kiribati"], ["KP", {STRING_32} "Korea, Democratic People's Republic of"], + ["KR", {STRING_32} "Korea, Republic of"], + ["KW", {STRING_32} "Kuwait"], ["KG", {STRING_32} "Kyrgyzstan"], ["LA", {STRING_32} "Lao People's Democratic Republic"], + ["LV", {STRING_32} "Latvia"], ["LB", {STRING_32} "Lebanon"], + ["LS", {STRING_32} "Lesotho"], ["LR", {STRING_32} "Liberia"], ["LY", {STRING_32} "Libya"], + ["LI", {STRING_32} "Liechtenstein"], ["LT", {STRING_32} "Lithuania"], ["LU", {STRING_32} "Luxembourg"], + ["MO", {STRING_32} "Macao"], ["MK", {STRING_32} "Macedonia, the former Yugoslav Republic of"], + ["MG", {STRING_32} "Madagascar"], ["MW", {STRING_32} "Malawi"], + ["MY", {STRING_32} "Malaysia"], ["MV", {STRING_32} "Maldives"], ["ML", {STRING_32} "Mali"], + ["MT", {STRING_32} "Malta"], ["MH", {STRING_32} "Marshall Islands"], ["MQ", {STRING_32} "Martinique"], + ["MR", {STRING_32} "Mauritania"], ["MU", {STRING_32} "Mauritius"], ["YT", {STRING_32} "Mayotte"], + ["MX", {STRING_32} "Mexico"], ["FM", {STRING_32} "Micronesia, Federated States of"], + ["MD", {STRING_32} "Moldova, Republic of"], ["MC", {STRING_32} "Monaco"], ["MN", {STRING_32} "Mongolia"], + ["ME", {STRING_32} "Montenegro"], ["MS", {STRING_32} "Montserrat"], + ["MA", {STRING_32} "Morocco"], ["MZ", {STRING_32} "Mozambique"], ["MM", {STRING_32} "Myanmar"], + ["NA", {STRING_32} "Namibia"], ["NR", {STRING_32} "Nauru"], ["NP", {STRING_32} "Nepal"], + ["NL", {STRING_32} "Netherlands"], ["NC", {STRING_32} "New Caledonia"], ["NZ", {STRING_32} "New Zealand"], + ["NI", {STRING_32} "Nicaragua"], ["NE", {STRING_32} "Niger"], + ["NG", {STRING_32} "Nigeria"], ["NU", {STRING_32} "Niue"], ["NF", {STRING_32} "Norfolk Island"], + ["MP", {STRING_32} "Northern Mariana Islands"], ["NO", {STRING_32} "Norway"], + ["OM", {STRING_32} "Oman"], ["PK", {STRING_32} "Pakistan"], ["PW", {STRING_32} "Palau"], + ["PS", {STRING_32} "Palestinian Territory, Occupied"], ["PA", {STRING_32} "Panama"], + ["PG", {STRING_32} "Papua New Guinea"], ["PY", {STRING_32} "Paraguay"], ["PE", {STRING_32} "Peru"], + ["PH", {STRING_32} "Philippines"], ["PN", {STRING_32} "Pitcairn"], + ["PL", {STRING_32} "Poland"], ["PT", {STRING_32} "Portugal"], ["PR", {STRING_32} "Puerto Rico"], + ["QA", {STRING_32} "Qatar"], ["RE", {STRING_32} "Réunion"], ["RO", {STRING_32} "Romania"], + ["RU", {STRING_32} "Russian Federation"], ["RW", {STRING_32} "Rwanda"], ["BL", {STRING_32} "Saint Barthélemy"], + ["SH", {STRING_32} "Saint Helena, Ascension and Tristan da Cunha"], + ["KN", {STRING_32} "Saint Kitts and Nevis"], ["LC", {STRING_32} "Saint Lucia"], ["MF", {STRING_32} "Saint Martin (French part)"], + ["PM", {STRING_32} "Saint Pierre and Miquelon"], + ["VC", {STRING_32} "Saint Vincent and the Grenadines"], ["WS", {STRING_32} "Samoa"], + ["SM", {STRING_32} "San Marino"], ["ST", {STRING_32} "Sao Tome and Principe"], + ["SA", {STRING_32} "Saudi Arabia"], ["SN", {STRING_32} "Senegal"], ["RS", {STRING_32} "Serbia"], + ["SC", {STRING_32} "Seychelles"], ["SL", {STRING_32} "Sierra Leone"], + ["SG", {STRING_32} "Singapore"], ["SX", {STRING_32} "Sint Maarten (Dutch part)"], ["SK", {STRING_32} "Slovakia"], + ["SI", {STRING_32} "Slovenia"], ["SB", {STRING_32} "Solomon Islands"], + ["SO", {STRING_32} "Somalia"], ["ZA", {STRING_32} "South Africa"], ["GS", {STRING_32} "South Georgia and the South Sandwich Islands"], + ["SS", {STRING_32} "South Sudan"], + ["ES", {STRING_32} "Spain"], ["LK", {STRING_32} "Sri Lanka"], ["SD", {STRING_32} "Sudan"], ["SR", {STRING_32} "Suriname"], + ["SJ", {STRING_32} "Svalbard and Jan Mayen"], + ["SZ", {STRING_32} "Swaziland"], ["SE", {STRING_32} "Sweden"], ["CH", {STRING_32} "Switzerland"], + ["SY", {STRING_32} "Syrian Arab Republic"], + ["TW", {STRING_32} "Taiwan, Province of China"], ["TJ", {STRING_32} "Tajikistan"], + ["TZ", {STRING_32} "Tanzania, United Republic of"], ["TH", {STRING_32} "Thailand"], + ["TL", {STRING_32} "Timor-Leste"], ["TG", {STRING_32} "Togo"], ["TK", {STRING_32} "Tokelau"], + ["TO", {STRING_32} "Tonga"], ["TT", {STRING_32} "Trinidad and Tobago"], + ["TN", {STRING_32} "Tunisia"], ["TR", {STRING_32} "Turkey"], ["TM", {STRING_32} "Turkmenistan"], + ["TC", {STRING_32} "Turks and Caicos Islands"], ["TV", {STRING_32} "Tuvalu"], + ["UG", {STRING_32} "Uganda"], ["UA", {STRING_32} "Ukraine"], ["AE", {STRING_32} "United Arab Emirates"], + ["GB", {STRING_32} "United Kingdom"], ["US", {STRING_32} "United States"], + ["UM", {STRING_32} "United States Minor Outlying Islands"], ["UY", {STRING_32} "Uruguay"], + ["UZ", {STRING_32} "Uzbekistan"], ["VU", {STRING_32} "Vanuatu"], + ["VE", {STRING_32} "Venezuela, Bolivarian Republic of"], ["VN", {STRING_32} "Viet Nam"], + ["VG", {STRING_32} "Virgin Islands, British"], + ["VI", {STRING_32} "Virgin Islands, U.S."], ["WF", {STRING_32} "Wallis and Futuna"], + ["EH", {STRING_32} "Western Sahara"], ["YE", {STRING_32} "Yemen"], + ["ZM", {STRING_32} "Zambia"], ["ZW", {STRING_32} "Zimbabwe"] + >> + + create Result.make_array + across + list as c + loop + if + attached c.item.short as first and + attached c.item.name as second + then + if second.as_lower.has_substring (input.as_lower) then + create o.make + o.put (create {JSON_STRING}.make_json (first.as_lower), "flag") + o.put (create {JSON_STRING}.make_json_from_string_32 (second), "value") + Result.add (o) + end + end + end + end + +end diff --git a/examples/widgetapp/autocompletion/google_autocompletion.e b/draft/library/wsf_js_widget/examples/demo/autocompletion/google_autocompletion.e similarity index 70% rename from examples/widgetapp/autocompletion/google_autocompletion.e rename to draft/library/wsf_js_widget/examples/demo/autocompletion/google_autocompletion.e index f981e7f5..76ec5cd0 100644 --- a/examples/widgetapp/autocompletion/google_autocompletion.e +++ b/draft/library/wsf_js_widget/examples/demo/autocompletion/google_autocompletion.e @@ -33,24 +33,31 @@ feature -- Implementation o: JSON_OBJECT json_parser: JSON_PARSER query_str: STRING_32 + ctx: HTTP_CLIENT_REQUEST_CONTEXT do query_str := input query_str.replace_substring_all (" ", "+") create cl.make sess := cl.new_session ("http://google.com") - if attached sess.get ("/complete/search?client=chrome&q=" + query_str, Void) as resp and then not resp.error_occurred then + create ctx.make + ctx.add_query_parameter ("q", query_str) + if attached sess.get ("/complete/search?client=chrome", ctx) as resp and then not resp.error_occurred then l_json := resp.body end create Result.make_array if l_json /= Void and then not l_json.is_empty then create json_parser.make_parser (l_json) - if attached {JSON_ARRAY} json_parser.parse_json as data and then attached {JSON_ARRAY} data.i_th (2) as list then + if + attached {JSON_ARRAY} json_parser.parse_json as data and then + data.valid_index (2) and then + attached {JSON_ARRAY} data.i_th (2) as list + then across 1 |..| list.count as c loop if attached {JSON_STRING} list.i_th (c.item) as row then create o.make - o.put (create {JSON_STRING}.make_json (row.unescaped_STRING_32), "value") + o.put (create {JSON_STRING}.make_with_escaped_json (row.item), "value") Result.add (o) end end diff --git a/examples/widgetapp/base_page.e b/draft/library/wsf_js_widget/examples/demo/base_page.e similarity index 100% rename from examples/widgetapp/base_page.e rename to draft/library/wsf_js_widget/examples/demo/base_page.e diff --git a/examples/widgetapp/codeview_page.e b/draft/library/wsf_js_widget/examples/demo/codeview_page.e similarity index 100% rename from examples/widgetapp/codeview_page.e rename to draft/library/wsf_js_widget/examples/demo/codeview_page.e diff --git a/examples/widgetapp/widgetapp.ecf b/draft/library/wsf_js_widget/examples/demo/demo.ecf similarity index 62% rename from examples/widgetapp/widgetapp.ecf rename to draft/library/wsf_js_widget/examples/demo/demo.ecf index 4e95c200..174de836 100644 --- a/examples/widgetapp/widgetapp.ecf +++ b/draft/library/wsf_js_widget/examples/demo/demo.ecf @@ -1,5 +1,5 @@ - + /EIFGENs$ @@ -10,36 +10,36 @@ - + - - + + - + - - - + + + - + - - + + - + - - + + - + diff --git a/examples/widgetapp/googlenews/google_news.e b/draft/library/wsf_js_widget/examples/demo/googlenews/google_news.e similarity index 88% rename from examples/widgetapp/googlenews/google_news.e rename to draft/library/wsf_js_widget/examples/demo/googlenews/google_news.e index 2de56ff8..11386b42 100644 --- a/examples/widgetapp/googlenews/google_news.e +++ b/draft/library/wsf_js_widget/examples/demo/googlenews/google_news.e @@ -19,16 +19,16 @@ feature {NONE} make_from_json (json: JSON_OBJECT) do if attached {JSON_STRING} json.item ("title") as l_title then - title := l_title.unescaped_STRING_32 + title := l_title.unescaped_string_32 end if attached {JSON_STRING} json.item ("content") as l_content then - content := l_content.unescaped_STRING_32 + content := l_content.unescaped_string_32 end if attached {JSON_OBJECT} json.item ("image") as img and then attached {JSON_STRING} img.item ("url") as l_image then - image := l_image.item + image := l_image.unescaped_string_32 end end diff --git a/examples/widgetapp/googlenews/google_news_datasource.e b/draft/library/wsf_js_widget/examples/demo/googlenews/google_news_datasource.e similarity index 62% rename from examples/widgetapp/googlenews/google_news_datasource.e rename to draft/library/wsf_js_widget/examples/demo/googlenews/google_news_datasource.e index 29e9f3b9..78d67454 100644 --- a/examples/widgetapp/googlenews/google_news_datasource.e +++ b/draft/library/wsf_js_widget/examples/demo/googlenews/google_news_datasource.e @@ -34,14 +34,14 @@ feature -- States -- Return state which contains the current html and if there is an event handle attached do Result := Precursor - Result.put_string (query, create {JSON_STRING}.make_json ("query")) + Result.put_string (query, "query") end set_state (new_state: JSON_OBJECT) do Precursor (new_state) - if attached {JSON_STRING} new_state.item (create {JSON_STRING}.make_json ("query")) as new_query then - query := new_query.item + if attached {JSON_STRING} new_state.item ("query") as new_query then + query := new_query.unescaped_string_32 end end @@ -49,22 +49,24 @@ feature -- Access data: ITERABLE [GOOGLE_NEWS] local - list: LINKED_LIST [GOOGLE_NEWS] + list: detachable ARRAYED_LIST [GOOGLE_NEWS] l_json: detachable READABLE_STRING_8 json_parser: JSON_PARSER query_str: STRING_32 cl: LIBCURL_HTTP_CLIENT sess: HTTP_CLIENT_SESSION + ctx: HTTP_CLIENT_REQUEST_CONTEXT do - create list.make row_count := 0 - query_str := query.out - query_str.replace_substring_all (" ", "+") + query_str := query + query_str.replace_substring_all ({STRING_32} " ", {STRING_32} "+") create cl.make sess := cl.new_session ("https://ajax.googleapis.com/ajax/services/search") sess.set_is_insecure (True) if sess.is_available then - if attached {HTTP_CLIENT_RESPONSE} sess.get ("/news?v=1.0&q=" + query_str + "&rsz=" + page_size.out + "&start=" + (page_size * (page - 1)).out, Void) as l_response then + create ctx.make + ctx.add_query_parameter ("q", query_str) + if attached {HTTP_CLIENT_RESPONSE} sess.get ("/news?v=1.0&rsz=" + page_size.out + "&start=" + (page_size * (page - 1)).out, ctx) as l_response then if not l_response.error_occurred then l_json := l_response.body end @@ -73,10 +75,18 @@ feature -- Access if l_json /= Void and then not l_json.is_empty then create json_parser.make_parser (l_json) if attached {JSON_OBJECT} json_parser.parse_json as sp then - if attached {JSON_OBJECT} sp.item (create {JSON_STRING}.make_json ("responseData")) as responsedata and then attached {JSON_ARRAY} responsedata.item (create {JSON_STRING}.make_json ("results")) as results then - if attached {JSON_OBJECT} responsedata.item (create {JSON_STRING}.make_json ("cursor")) as cursor and then attached {JSON_STRING} cursor.item (create {JSON_STRING}.make_json ("estimatedResultCount")) as count then + if + attached {JSON_OBJECT} sp.item ("responseData") as responsedata and then + attached {JSON_ARRAY} responsedata.item ("results") as results + then + row_count := 0 + if + attached {JSON_OBJECT} responsedata.item ("cursor") as cursor and then + attached {JSON_STRING} cursor.item ("estimatedResultCount") as count + then row_count := count.item.to_integer.min (64) end + create list.make (results.count) across 1 |..| results.count as c loop @@ -87,6 +97,9 @@ feature -- Access end end end + if list = Void then + create list.make (0) + end Result := list end diff --git a/examples/widgetapp/googlenews/google_news_repeater.e b/draft/library/wsf_js_widget/examples/demo/googlenews/google_news_repeater.e similarity index 100% rename from examples/widgetapp/googlenews/google_news_repeater.e rename to draft/library/wsf_js_widget/examples/demo/googlenews/google_news_repeater.e diff --git a/examples/widgetapp/grid_page.e b/draft/library/wsf_js_widget/examples/demo/grid_page.e similarity index 100% rename from examples/widgetapp/grid_page.e rename to draft/library/wsf_js_widget/examples/demo/grid_page.e diff --git a/examples/widgetapp/own_validator.e b/draft/library/wsf_js_widget/examples/demo/own_validator.e similarity index 100% rename from examples/widgetapp/own_validator.e rename to draft/library/wsf_js_widget/examples/demo/own_validator.e diff --git a/examples/widgetapp/progress/increasing_progresssource.e b/draft/library/wsf_js_widget/examples/demo/progress/increasing_progresssource.e similarity index 100% rename from examples/widgetapp/progress/increasing_progresssource.e rename to draft/library/wsf_js_widget/examples/demo/progress/increasing_progresssource.e diff --git a/examples/widgetapp/repeater_page.e b/draft/library/wsf_js_widget/examples/demo/repeater_page.e similarity index 100% rename from examples/widgetapp/repeater_page.e rename to draft/library/wsf_js_widget/examples/demo/repeater_page.e diff --git a/examples/widgetapp/sample_page.e b/draft/library/wsf_js_widget/examples/demo/sample_page.e similarity index 100% rename from examples/widgetapp/sample_page.e rename to draft/library/wsf_js_widget/examples/demo/sample_page.e diff --git a/examples/widgetapp/slider_page.e b/draft/library/wsf_js_widget/examples/demo/slider_page.e similarity index 100% rename from examples/widgetapp/slider_page.e rename to draft/library/wsf_js_widget/examples/demo/slider_page.e diff --git a/examples/widgetapp/upload_page.e b/draft/library/wsf_js_widget/examples/demo/upload_page.e similarity index 100% rename from examples/widgetapp/upload_page.e rename to draft/library/wsf_js_widget/examples/demo/upload_page.e diff --git a/examples/widgetapp/widgetapp.rc b/draft/library/wsf_js_widget/examples/demo/widgetapp.rc similarity index 100% rename from examples/widgetapp/widgetapp.rc rename to draft/library/wsf_js_widget/examples/demo/widgetapp.rc diff --git a/draft/library/wsf_js_widget/kernel/grid/wsf_pagination_control.e b/draft/library/wsf_js_widget/kernel/grid/wsf_pagination_control.e index 900e7234..9ab62e8f 100644 --- a/draft/library/wsf_js_widget/kernel/grid/wsf_pagination_control.e +++ b/draft/library/wsf_js_widget/kernel/grid/wsf_pagination_control.e @@ -43,7 +43,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management update -- Send new renederd control to client on update do - state_changes.replace (create {JSON_STRING}.make_json (render), "_html") + state_changes.replace (create {JSON_STRING}.make_json_from_string_32 (render), "_html") end feature --Event handling diff --git a/draft/library/wsf_js_widget/kernel/grid/wsf_repeater_control.e b/draft/library/wsf_js_widget/kernel/grid/wsf_repeater_control.e index 669040ce..12afe83a 100644 --- a/draft/library/wsf_js_widget/kernel/grid/wsf_repeater_control.e +++ b/draft/library/wsf_js_widget/kernel/grid/wsf_repeater_control.e @@ -37,9 +37,9 @@ feature {NONE} -- Initialization feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management update - -- Send new renederd control to client on update + -- Send new rendered control to client on update do - state_changes.replace (create {JSON_STRING}.make_json (render_body), "_body") + state_changes.replace (create {JSON_STRING}.make_json_from_string_32 (render_body), "_body") state_changes.replace (datasource.state, "datasource") end diff --git a/draft/library/wsf_js_widget/kernel/input/wsf_input_control.e b/draft/library/wsf_js_widget/kernel/input/wsf_input_control.e index 6f8a3faf..d43f4126 100644 --- a/draft/library/wsf_js_widget/kernel/input/wsf_input_control.e +++ b/draft/library/wsf_js_widget/kernel/input/wsf_input_control.e @@ -100,7 +100,7 @@ feature -- Change do if not t.same_string (text) then text := t - state_changes.replace (create {JSON_STRING}.make_json (text), "text") + state_changes.replace (create {JSON_STRING}.make_json_from_string_32 (t), "text") end ensure text_same_string_as_t: text.same_string (t) diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_dynamic_multi_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_dynamic_multi_control.e index 731f95c9..1fd66bf4 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_dynamic_multi_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_dynamic_multi_control.e @@ -163,7 +163,7 @@ feature if items_changed then new_state := state create sub_state.make - read_subcontrol_state (sub_state) + add_sub_controls_states_to (sub_state) new_state.put (sub_state, "newstate") new_state.put_string (render, "render") states.put (new_state, control_name) diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e index ef5b7746..9f5ca8eb 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e @@ -209,7 +209,7 @@ feature -- Validation -- Set the error message that will be displayed upon failure of client side validation do error := e - state_changes.replace (create {JSON_STRING}.make_json (e), "error") + state_changes.replace (create {JSON_STRING}.make_json_from_string_32 (e), "error") ensure error_set: error.same_string (e) end diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e index 2e134b65..f3c64a1f 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e @@ -78,25 +78,27 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management full_state: WSF_JSON_OBJECT -- Read states in subcontrols local - controls_state: WSF_JSON_OBJECT + l_state: WSF_JSON_OBJECT do Result := Precursor - create controls_state.make - read_subcontrol_state (controls_state) - Result.put (controls_state, "controls") + create l_state.make + add_sub_controls_states_to (l_state) + Result.put (l_state, "controls") end - read_subcontrol_state (controls_state: JSON_OBJECT) - -- Read add subcontrol state in to the controls_state json object. - -- If the subcontrol is a stateless multicontrol x. We add the state of the subcontrols of x directly to controls_state. (Stateless multi controls do not add a hierarchy level) + add_sub_controls_states_to (a_controls_state: JSON_OBJECT) + -- Read add subcontrol state in to the `a_controls_state' json object. + -- If the subcontrol is a stateless multicontrol x, + -- the states of the subcontrols of x are directly added to `a_controls_state'. + -- (Stateless multi controls do not add a hierarchy level) do across controls as c loop if attached {WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]} c.item as mcont then - mcont.read_subcontrol_state (controls_state) + mcont.add_sub_controls_states_to (a_controls_state) elseif attached {WSF_CONTROL} c.item as cont then - controls_state.put (cont.full_state, cont.control_name) + a_controls_state.put (cont.full_state, cont.control_name) end end end diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_page_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_page_control.e index e3971166..7b9716b6 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_page_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_page_control.e @@ -80,7 +80,7 @@ feature -- Implementation event := get_parameter ("event") event_parameter := get_parameter ("event_parameter") if attached event and attached event_control_name and attached control then - if not event.is_equal ("uploadfile") then + if not event.same_string_general ("uploadfile") then create states.make_empty request.read_input_data_into (states) create json_parser.make_parser (states) diff --git a/draft/library/wsf_js_widget/wsf_js_widget-safe.ecf b/draft/library/wsf_js_widget/wsf_js_widget-safe.ecf index 6dea1b7a..325980be 100644 --- a/draft/library/wsf_js_widget/wsf_js_widget-safe.ecf +++ b/draft/library/wsf_js_widget/wsf_js_widget-safe.ecf @@ -17,6 +17,10 @@ - + + + /examples$ + + diff --git a/draft/library/wsf_js_widget/wsf_js_widget.ecf b/draft/library/wsf_js_widget/wsf_js_widget.ecf index 0b5d286a..f43fc79a 100644 --- a/draft/library/wsf_js_widget/wsf_js_widget.ecf +++ b/draft/library/wsf_js_widget/wsf_js_widget.ecf @@ -16,6 +16,10 @@ - + + + /examples$ + + diff --git a/examples/widgetapp/autocompletion/flag_autocompletion.e b/examples/widgetapp/autocompletion/flag_autocompletion.e deleted file mode 100644 index 7c433155..00000000 --- a/examples/widgetapp/autocompletion/flag_autocompletion.e +++ /dev/null @@ -1,49 +0,0 @@ -note - description: "Summary description for {FLAG_AUTOCOMPLETION}." - author: "" - date: "$Date$" - revision: "$Revision$" - -class - FLAG_AUTOCOMPLETION - -inherit - - WSF_AUTOCOMPLETION - -create - make - -feature {NONE} -- Initialization - - make - -- Initialize - do - template := " {{=value}}"; - end - -feature -- Implementation - - autocompletion (input: STRING_32): JSON_ARRAY - -- Implementation - local - list: ITERABLE [TUPLE [STRING, STRING]] - o: JSON_OBJECT - do - list := <<["AF", "Afghanistan"], ["AX", "Åland Islands"], ["AL", "Albania"], ["DZ", "Algeria"], ["AS", "American Samoa"], ["AD", "Andorra"], ["AO", "Angola"], ["AI", "Anguilla"], ["AQ", "Antarctica"], ["AG", "Antigua and Barbuda"], ["AR", "Argentina"], ["AM", "Armenia"], ["AW", "Aruba"], ["AU", "Australia"], ["AT", "Austria"], ["AZ", "Azerbaijan"], ["BS", "Bahamas"], ["BH", "Bahrain"], ["BD", "Bangladesh"], ["BB", "Barbados"], ["BY", "Belarus"], ["BE", "Belgium"], ["BZ", "Belize"], ["BJ", "Benin"], ["BM", "Bermuda"], ["BT", "Bhutan"], ["BO", "Bolivia, Plurinational State of"], ["BQ", "Bonaire, Sint Eustatius and Saba"], ["BA", "Bosnia and Herzegovina"], ["BW", "Botswana"], ["BV", "Bouvet Island"], ["BR", "Brazil"], ["IO", "British Indian Ocean Territory"], ["BN", "Brunei Darussalam"], ["BG", "Bulgaria"], ["BF", "Burkina Faso"], ["BI", "Burundi"], ["KH", "Cambodia"], ["CM", "Cameroon"], ["CA", "Canada"], ["CV", "Cape Verde"], ["KY", "Cayman Islands"], ["CF", "Central African Republic"], ["TD", "Chad"], ["CL", "Chile"], ["CN", "China"], ["CX", "Christmas Island"], ["CC", "Cocos (Keeling) Islands"], ["CO", "Colombia"], ["KM", "Comoros"], ["CG", "Congo"], ["CD", "Congo, the Democratic Republic of the"], ["CK", "Cook Islands"], ["CR", "Costa Rica"], ["CI", "Côte d'Ivoire"], ["HR", "Croatia"], ["CU", "Cuba"], ["CW", "Curaçao"], ["CY", "Cyprus"], ["CZ", "Czech Republic"], ["DK", "Denmark"], ["DJ", "Djibouti"], ["DM", "Dominica"], ["DO", "Dominican Republic"], ["EC", "Ecuador"], ["EG", "Egypt"], ["SV", "El Salvador"], ["GQ", "Equatorial Guinea"], ["ER", "Eritrea"], ["EE", "Estonia"], ["ET", "Ethiopia"], ["FK", "Falkland Islands (Malvinas)"], ["FO", "Faroe Islands"], ["FJ", "Fiji"], ["FI", "Finland"], ["FR", "France"], ["GF", "French Guiana"], ["PF", "French Polynesia"], ["TF", "French Southern Territories"], ["GA", "Gabon"], ["GM", "Gambia"], ["GE", "Georgia"], ["DE", "Germany"], ["GH", "Ghana"], ["GI", "Gibraltar"], ["GR", "Greece"], ["GL", "Greenland"], ["GD", "Grenada"], ["GP", "Guadeloupe"], ["GU", "Guam"], ["GT", "Guatemala"], ["GG", "Guernsey"], ["GN", "Guinea"], ["GW", "Guinea-Bissau"], ["GY", "Guyana"], ["HT", "Haiti"], ["HM", "Heard Island and McDonald Islands"], ["VA", "Holy See (Vatican City State)"], ["HN", "Honduras"], ["HK", "Hong Kong"], ["HU", "Hungary"], ["IS", "Iceland"], ["IN", "India"], ["ID", "Indonesia"], ["IR", "Iran, Islamic Republic of"], ["IQ", "Iraq"], ["IE", "Ireland"], ["IM", "Isle of Man"], ["IL", "Israel"], ["IT", "Italy"], ["JM", "Jamaica"], ["JP", "Japan"], ["JE", "Jersey"], ["JO", "Jordan"], ["KZ", "Kazakhstan"], ["KE", "Kenya"], ["KI", "Kiribati"], ["KP", "Korea, Democratic People's Republic of"], ["KR", "Korea, Republic of"], ["KW", "Kuwait"], ["KG", "Kyrgyzstan"], ["LA", "Lao People's Democratic Republic"], ["LV", "Latvia"], ["LB", "Lebanon"], ["LS", "Lesotho"], ["LR", "Liberia"], ["LY", "Libya"], ["LI", "Liechtenstein"], ["LT", "Lithuania"], ["LU", "Luxembourg"], ["MO", "Macao"], ["MK", "Macedonia, the former Yugoslav Republic of"], ["MG", "Madagascar"], ["MW", "Malawi"], ["MY", "Malaysia"], ["MV", "Maldives"], ["ML", "Mali"], ["MT", "Malta"], ["MH", "Marshall Islands"], ["MQ", "Martinique"], ["MR", "Mauritania"], ["MU", "Mauritius"], ["YT", "Mayotte"], ["MX", "Mexico"], ["FM", "Micronesia, Federated States of"], ["MD", "Moldova, Republic of"], ["MC", "Monaco"], ["MN", "Mongolia"], ["ME", "Montenegro"], ["MS", "Montserrat"], ["MA", "Morocco"], ["MZ", "Mozambique"], ["MM", "Myanmar"], ["NA", "Namibia"], ["NR", "Nauru"], ["NP", "Nepal"], ["NL", "Netherlands"], ["NC", "New Caledonia"], ["NZ", "New Zealand"], ["NI", "Nicaragua"], ["NE", "Niger"], ["NG", "Nigeria"], ["NU", "Niue"], ["NF", "Norfolk Island"], ["MP", "Northern Mariana Islands"], ["NO", "Norway"], ["OM", "Oman"], ["PK", "Pakistan"], ["PW", "Palau"], ["PS", "Palestinian Territory, Occupied"], ["PA", "Panama"], ["PG", "Papua New Guinea"], ["PY", "Paraguay"], ["PE", "Peru"], ["PH", "Philippines"], ["PN", "Pitcairn"], ["PL", "Poland"], ["PT", "Portugal"], ["PR", "Puerto Rico"], ["QA", "Qatar"], ["RE", "Réunion"], ["RO", "Romania"], ["RU", "Russian Federation"], ["RW", "Rwanda"], ["BL", "Saint Barthélemy"], ["SH", "Saint Helena, Ascension and Tristan da Cunha"], ["KN", "Saint Kitts and Nevis"], ["LC", "Saint Lucia"], ["MF", "Saint Martin (French part)"], ["PM", "Saint Pierre and Miquelon"], ["VC", "Saint Vincent and the Grenadines"], ["WS", "Samoa"], ["SM", "San Marino"], ["ST", "Sao Tome and Principe"], ["SA", "Saudi Arabia"], ["SN", "Senegal"], ["RS", "Serbia"], ["SC", "Seychelles"], ["SL", "Sierra Leone"], ["SG", "Singapore"], ["SX", "Sint Maarten (Dutch part)"], ["SK", "Slovakia"], ["SI", "Slovenia"], ["SB", "Solomon Islands"], ["SO", "Somalia"], ["ZA", "South Africa"], ["GS", "South Georgia and the South Sandwich Islands"], ["SS", "South Sudan"], ["ES", "Spain"], ["LK", "Sri Lanka"], ["SD", "Sudan"], ["SR", "Suriname"], ["SJ", "Svalbard and Jan Mayen"], ["SZ", "Swaziland"], ["SE", "Sweden"], ["CH", "Switzerland"], ["SY", "Syrian Arab Republic"], ["TW", "Taiwan, Province of China"], ["TJ", "Tajikistan"], ["TZ", "Tanzania, United Republic of"], ["TH", "Thailand"], ["TL", "Timor-Leste"], ["TG", "Togo"], ["TK", "Tokelau"], ["TO", "Tonga"], ["TT", "Trinidad and Tobago"], ["TN", "Tunisia"], ["TR", "Turkey"], ["TM", "Turkmenistan"], ["TC", "Turks and Caicos Islands"], ["TV", "Tuvalu"], ["UG", "Uganda"], ["UA", "Ukraine"], ["AE", "United Arab Emirates"], ["GB", "United Kingdom"], ["US", "United States"], ["UM", "United States Minor Outlying Islands"], ["UY", "Uruguay"], ["UZ", "Uzbekistan"], ["VU", "Vanuatu"], ["VE", "Venezuela, Bolivarian Republic of"], ["VN", "Viet Nam"], ["VG", "Virgin Islands, British"], ["VI", "Virgin Islands, U.S."], ["WF", "Wallis and Futuna"], ["EH", "Western Sahara"], ["YE", "Yemen"], ["ZM", "Zambia"], ["ZW", "Zimbabwe"]>> - create Result.make_array - across - list as c - loop - if attached {STRING} c.item.item (1) as first and attached {STRING} c.item.item (2) as second then - if second.as_lower.has_substring (input.as_lower) then - create o.make - o.put (create {JSON_STRING}.make_json (first.as_lower), "flag") - o.put (create {JSON_STRING}.make_json (second), "value") - Result.add (o) - end - end - end - end - -end