Commit 7fafed522a576f151c257dc9e3c576ae825d3070

Authored by David RENE
1 parent 0e2959c0

Add language parameter to jquery_datatable to enable to translate the datatable …

…decorator like search fields and so forth.
Add folder jquery into web/ to permit gather everything concerning jquery in same location.
Remove bool_to_string replaced by to_String which is located in system/convert
web/CXM_jquery_datatable.anubis
... ... @@ -10,8 +10,10 @@
10 10 read calexium_lib/web/CXM_making_a_web_site.anubis
11 11 read calexium_lib/web/CXM_jquery.anubis
12 12 read calexium_lib/web/CXM_jquery_datatable_types.anubis
  13 +read calexium_lib/web/jquery/CXM_jquery_datatable_translation.anubis
13 14 read tools/basis.anubis
14 15 read system/string.anubis
  16 +read system/convert.anubis
15 17  
16 18 /* Initialize jQuery in compatiblity mode with jQueryUI */
17 19 public define List(HTML_Head_Tag)
... ... @@ -57,15 +59,7 @@ public define HTML_Partial_Content
57 59 else
58 60 jquery_datatable(table_id, table)
59 61 .
60   -
61   -public define String
62   - bool_to_string
63   - (
64   - Bool b
65   - )
66   - =
67   - if b then "true" else "false"
68   - .
  62 +
69 63  
70 64 public define HTML_Partial_Content
71 65 jquery_datatable
... ... @@ -77,7 +71,8 @@ public define HTML_Partial_Content
77 71 JQuery_datatable_pagination_type pagination_type,
78 72 Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
79 73 Bool enable_search_field,
80   - Bool enable_columns_sorting
  74 + Bool enable_columns_sorting,
  75 + String lang
81 76 )
82 77 =
83 78 partial_content(
... ... @@ -90,12 +85,13 @@ public define HTML_Partial_Content
90 85 {
91 86 $('#"+table_id+"').dataTable(
92 87 {
93   - \"bJQueryUI\":"+bool_to_string(enable_jqueryui)+",
  88 + \"bJQueryUI\":"+to_String(enable_jqueryui)+",
94 89 \"sPaginationType\":'"+jquery_datatable_pagination_type_to_string(pagination_type)+"',
95   - \"bFilter\":"+bool_to_string(enable_search_field)+",
96   - \"bPaginate\":"+bool_to_string(enable_pagination)+",
97   - \"bLengthChange\":"+bool_to_string(enable_change_page_length)+",
98   - \"bSort\":"+bool_to_string(enable_columns_sorting)+"
  90 + \"bFilter\":"+to_String(enable_search_field)+",
  91 + \"bPaginate\":"+to_String(enable_pagination)+",
  92 + \"bLengthChange\":"+to_String(enable_change_page_length)+",
  93 + \"bSort\":"+to_String(enable_columns_sorting)+","+
  94 + get_datatable_translation(lang)+"
99 95 });
100 96 });
101 97 "
... ... @@ -105,3 +101,17 @@ public define HTML_Partial_Content
105 101 table
106 102 )
107 103 .
  104 +
  105 +public define HTML_Partial_Content
  106 + jquery_datatable
  107 + (
  108 + String table_id,
  109 + HTML_Off_Form table,
  110 + Bool enable_jqueryui,
  111 + Bool enable_pagination,
  112 + JQuery_datatable_pagination_type pagination_type,
  113 + Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
  114 + Bool enable_search_field,
  115 + Bool enable_columns_sorting
  116 + ) =
  117 + jquery_datatable(table_id, table, enable_jqueryui, enable_pagination, pagination_type, enable_change_page_length, enable_search_field, enable_columns_sorting, "en").
... ...
web/jQuery/CXM_jquery_datatable_translation.anubis 0 → 100644
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: Totoro
  4 + * Date: 17/09/2012
  5 + * Time: 17:37
  6 + *
  7 + * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8 + */
  9 +
  10 +
  11 +public define String
  12 + get_datatable_translation
  13 + (
  14 + String language
  15 + )=
  16 + with file = if language = "en" then "en" else
  17 + if language = "fr" then "fr" else
  18 + if language = "zh" then "zh" else
  19 + if language = "ja" then "ja" else
  20 + "en",
  21 + "\"oLanguage\": {
  22 + \"sUrl\": \"/js/jquery/dataTables/"+file+".txt\"
  23 + }".
  24 +
  25 +
... ...