Commit a8f9078f8f01f08f9adeadd43aac477f34786c5e

Authored by totoro
1 parent d2c0cc9e

Bump to jQuery 1.11.3 & jQueryUI 1.11.4 & jQuery Datatable 1.10.7

asterisk/ami.anubis
1   -/*
2   - * Created by PyramIDE.
3   - * User: Totoro
4   - * Date: 13/07/2013
5   - * Time: 02:07
6   - *
7   - * To change this template use Tools | Options | Coding | Edit Standard Headers.
8   - */
9   -
10   -read system/string.anubis
11   -read tools/basis.anubis
12   -read tools/connections.anubis
13   -
14   -read asterisk/ami_types.anubis
15   -read asterisk/ami_commands.anubis
16   -read web/CXM_http_get_common.anubis
17   -
18   -
19   -
20   - public define Result(
21   -
22   -define Maybe(One)
23   - receive
24   - (
25   - Bool print_dump,
26   - Connection conn
27   - )=
28   - //TODO find the header and content-lenght to get full length of answer
29   -
30   - if read(conn, 16384, 5) is
31   - {
32   - error then println("Read error");failure,
33   - timeout then println("Read timeout");failure,
34   - ok(ba) then
35   - with ami_response = to_string(ba),
36   - // typed_response = xml_rpc_get_response(xml_response),
37   - if print_dump then
38   -
39   - success(println("=== ASTERISK SERVER answer ==="+crlf +"["+ ami_response + "]" ))
40   - //println("=== XML_RPC Anubis interpretation ===");
41   -
42   - /* if typed_response is
43   - {
44   - failure then println("Interpretation error"),
45   - success(result) then
46   - if result is
47   - {
48   - ok(ok_res) then println(format_xml_rpc_parameters(ok_res,1)),
49   - fault(fault) then println(format_xml_rpc_fault(fault,1))
50   - }
51   -
52   - } */
53   -
54   - else success(unique)
55   - }
56   - .
57   -
58   -define Maybe(String)
59   - _format_action
60   - (
61   - String so_far,
62   - List(Key_value) values
63   - )=
64   - if values is
65   - {
66   - [] then success(so_far+crlf),
67   - [h . t] then
68   - if h is key_value(key, value) then
69   - _format_action(so_far+key+": "+value+crlf, t)
70   - }.
71   -
72   - /** Format the AMI action
73   - *
74   - */
75   -
76   -define Maybe(String)
77   - format_action
78   - (
79   - AMI_Action action
80   - )=
81   - if action is action(action_type, values_list) then
82   - _format_action( "Action: "+action_type+crlf,
83   - //"ActionID: "+
84   - values_list)
85   - .
86   -
87   -
88   -
89   -public define Maybe(One)
90   - send_action
91   - (
92   - Asterisk_client client,
93   - AMI_Action action
94   - )=
95   - if client is asterisk_client(conn, _, auth) then
96   -
97   - //format the action into string
98   - if format_action(action) is
99   - {
100   - failure then failure
101   - success(action_str) then
102   - //send the action trough the connection to Asterisk
103   - println("=== ACTION ===");
104   - print(action_str);
105   - println("=== END ACTION ===");
106   -
107   - if write(conn, to_byte_array(action_str)) is
108   - {
109   - failure then failure,
110   - success(_) then receive(true, conn)
111   - }
112   - }.
113   -
114   -public define Maybe(Asterisk_client)
115   - asterisk_new_client
116   - (
117   - String server_name,
118   - AMI_Auth auth
119   - )=
120   - if separate_name_port(server_name, 5038) is (name, server_port) then
121   - //
122   - // resolve server name and call 'https_get' with numeric server address:
123   - //
124   - with a = dns(name),
125   - if a is ok(server_addr) then
126   - println("TCP "+server_port+ " "+server_name);
127   - if (Result(NetworkConnectError,RWStream))connect(server_addr, server_port) is
128   - {
129   - error(e) then failure,
130   - ok(conn) then
131   - if read_line(tcp(conn), 80, 10) is
132   - {
133   - error then failure,
134   - timeout then failure,
135   - eof then failure,
136   - ok(str) then
137   - println("=== ASTERISK SERVER answer ==="+crlf +"["+ str + "]" );
138   - //to ensure that it is an Asterisk server we test the returned string
139   - if start_with(to_lower(str), "asterisk call manager") then
140   -
141   - with client = asterisk_client(tcp(conn), var(0), auth),
142   - if send_action(client, ami_login(auth)) is
143   - {
144   - failure then failure,
145   - success(_) then success(client)
146   - }
147   - else
148   - failure
149   -
150   - }
151   -
152   - }
153   - else
154   - failure.
155   -
156   -
157   -global define One
158   - ami_test
159   - (
160   - List(String) args
161   - )=
162   - if asterisk_new_client("192.168.3.20:5038", auth("admin","admin")) is
163   - {
164   - failure then println(" asterisk new client failure"),
165   - success(ami_client) then unique
166   - //forget(xml_rpc_client_execute(true, rpc_client, "/Settings", "list_domains", empty_param))
167   - //forget(xml_rpc_client_execute(true, rpc_client, "/Settings", "delete_domain", parameters([parameter[string("amisdefontainebleau.org")]])))
168   - //forget(xml_rpc_client_execute(true, rpc_client, "/Settings", "create_domain", empty_param))
169   - }.
170   -
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: Totoro
  4 + * Date: 13/07/2013
  5 + * Time: 02:07
  6 + *
  7 + */
  8 +
  9 +read system/string.anubis
  10 +read tools/basis.anubis
  11 +read tools/connections.anubis
  12 +
  13 +read asterisk/ami_types.anubis
  14 +read asterisk/ami_commands.anubis
  15 +read web/CXM_http_get_common.anubis
  16 +
  17 +
  18 +
  19 + public define Result(
  20 +
  21 +define Maybe(One)
  22 + receive
  23 + (
  24 + Bool print_dump,
  25 + Connection conn
  26 + )=
  27 + //TODO find the header and content-lenght to get full length of answer
  28 +
  29 + if read(conn, 16384, 5) is
  30 + {
  31 + error then println("Read error");failure,
  32 + timeout then println("Read timeout");failure,
  33 + ok(ba) then
  34 + with ami_response = to_string(ba),
  35 + // typed_response = xml_rpc_get_response(xml_response),
  36 + if print_dump then
  37 +
  38 + success(println("=== ASTERISK SERVER answer ==="+crlf +"["+ ami_response + "]" ))
  39 + //println("=== XML_RPC Anubis interpretation ===");
  40 +
  41 + /* if typed_response is
  42 + {
  43 + failure then println("Interpretation error"),
  44 + success(result) then
  45 + if result is
  46 + {
  47 + ok(ok_res) then println(format_xml_rpc_parameters(ok_res,1)),
  48 + fault(fault) then println(format_xml_rpc_fault(fault,1))
  49 + }
  50 +
  51 + } */
  52 +
  53 + else success(unique)
  54 + }
  55 + .
  56 +
  57 +define Maybe(String)
  58 + _format_action
  59 + (
  60 + String so_far,
  61 + List(Key_value) values
  62 + )=
  63 + if values is
  64 + {
  65 + [] then success(so_far+crlf),
  66 + [h . t] then
  67 + if h is key_value(key, value) then
  68 + _format_action(so_far+key+": "+value+crlf, t)
  69 + }.
  70 +
  71 + /** Format the AMI action
  72 + *
  73 + */
  74 +
  75 +define Maybe(String)
  76 + format_action
  77 + (
  78 + AMI_Action action
  79 + )=
  80 + if action is action(action_type, values_list) then
  81 + _format_action( "Action: "+action_type+crlf,
  82 + //"ActionID: "+
  83 + values_list)
  84 + .
  85 +
  86 +
  87 +
  88 +public define Maybe(One)
  89 + send_action
  90 + (
  91 + Asterisk_client client,
  92 + AMI_Action action
  93 + )=
  94 + if client is asterisk_client(conn, _, auth) then
  95 +
  96 + //format the action into string
  97 + if format_action(action) is
  98 + {
  99 + failure then failure
  100 + success(action_str) then
  101 + //send the action trough the connection to Asterisk
  102 + println("=== ACTION ===");
  103 + print(action_str);
  104 + println("=== END ACTION ===");
  105 +
  106 + if write(conn, to_byte_array(action_str)) is
  107 + {
  108 + failure then failure,
  109 + success(_) then receive(true, conn)
  110 + }
  111 + }.
  112 +
  113 +public define Maybe(Asterisk_client)
  114 + asterisk_new_client
  115 + (
  116 + String server_name,
  117 + AMI_Auth auth
  118 + )=
  119 + if separate_name_port(server_name, 5038) is (name, server_port) then
  120 + //
  121 + // resolve server name and call 'https_get' with numeric server address:
  122 + //
  123 + with a = dns(name),
  124 + if a is ok(server_addr) then
  125 + println("TCP "+server_port+ " "+server_name);
  126 + if (Result(NetworkConnectError,RWStream))connect(server_addr, server_port) is
  127 + {
  128 + error(e) then failure,
  129 + ok(conn) then
  130 + if read_line(tcp(conn), 80, 10) is
  131 + {
  132 + error then failure,
  133 + timeout then failure,
  134 + eof then failure,
  135 + ok(str) then
  136 + println("=== ASTERISK SERVER answer ==="+crlf +"["+ str + "]" );
  137 + //to ensure that it is an Asterisk server we test the returned string
  138 + if start_with(to_lower(str), "asterisk call manager") then
  139 +
  140 + with client = asterisk_client(tcp(conn), var(0), auth),
  141 + if send_action(client, ami_login(auth)) is
  142 + {
  143 + failure then failure,
  144 + success(_) then success(client)
  145 + }
  146 + else
  147 + failure
  148 +
  149 + }
  150 +
  151 + }
  152 + else
  153 + failure.
  154 +
  155 +
  156 +global define One
  157 + ami_test
  158 + (
  159 + List(String) args
  160 + )=
  161 + if asterisk_new_client("192.168.3.20:5038", auth("admin","admin")) is
  162 + {
  163 + failure then println(" asterisk new client failure"),
  164 + success(ami_client) then unique
  165 + //forget(xml_rpc_client_execute(true, rpc_client, "/Settings", "list_domains", empty_param))
  166 + //forget(xml_rpc_client_execute(true, rpc_client, "/Settings", "delete_domain", parameters([parameter[string("amisdefontainebleau.org")]])))
  167 + //forget(xml_rpc_client_execute(true, rpc_client, "/Settings", "create_domain", empty_param))
  168 + }.
  169 +
... ...
asterisk/ami_commands.anubis
1   -/*
2   - * Created by PyramIDE.
3   - * User: Totoro
4   - * Date: 14/07/2013
5   - * Time: 01:34
6   - *
7   - * To change this template use Tools | Options | Coding | Edit Standard Headers.
8   - */
9   -
10   -read asterisk/ami_types.anubis
11   -
12   -public define AMI_Action ami_login(String user, String password, Bool events) =
13   - action("Login", [
14   - key_value("Username",user),
15   - key_value("Secret", password),
16   - key_value("Events", if events then "on" else "off")
17   - ]).
18   -
19   -public define AMI_Action ami_login(String user, String password)=
20   - ami_login(user, password, true).
21   -
22   -public define AMI_Action ami_login(AMI_Auth ami_auth) =
23   - if ami_auth is auth(user, password) then
24   - ami_login(user, password, true).
25   -
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: Totoro
  4 + * Date: 14/07/2013
  5 + * Time: 01:34
  6 + *
  7 + */
  8 +
  9 +read asterisk/ami_types.anubis
  10 +
  11 +public define AMI_Action ami_login(String user, String password, Bool events) =
  12 + action("Login", [
  13 + key_value("Username",user),
  14 + key_value("Secret", password),
  15 + key_value("Events", if events then "on" else "off")
  16 + ]).
  17 +
  18 +public define AMI_Action ami_login(String user, String password)=
  19 + ami_login(user, password, true).
  20 +
  21 +public define AMI_Action ami_login(AMI_Auth ami_auth) =
  22 + if ami_auth is auth(user, password) then
  23 + ami_login(user, password, true).
  24 +
... ...
web/CXM_jquery.anubis
... ... @@ -57,8 +57,8 @@ define List(HTML_Head_Tag)
57 57 jquery_defaults
58 58 =
59 59 [
60   - js(js_file("/js/jquery/jquery-1.11.1.min.js")),
61   - js(js_file("/js/jquery/jquery-ui-1.10.4.custom.min.js")),
  60 + js(js_file("/jquery/jquery-1.11.3.js")),
  61 + js(js_file("/jquery/jquery-ui-1.11.4/jquery-ui.min.js")),
62 62 ].
63 63  
64 64 /* Initialize jQuery in compatiblity mode with jQueryUI */
... ... @@ -69,9 +69,11 @@ public define List(HTML_Head_Tag)
69 69 String theme_name
70 70 )
71 71 =
72   - if file_exists(web_dir+"/public/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css") then
73   - [ css(css_file("/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ]
  72 + if file_exists(web_dir+"/public/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.min.css") then
  73 + [ css(css_file("/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.min.css")),
  74 + css(css_file("/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.structure.min.css")),
  75 + css(css_file("/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.theme.min.css")) . jquery_defaults ]
74 76 else
75 77 println("Jquery Theme not found "+web_dir+"/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css");
76   - [ css(css_file("/css/jquery/redmond/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ]
  78 + [ css(css_file("/css/jquery/jquery-ui-1.11.4.custom.min.css")) . jquery_defaults ]
77 79 .
... ...
web/jQuery/CXM_jquery_datatable.anubis
... ... @@ -17,13 +17,13 @@ read system/convert.anubis
17 17  
18 18 /* Initialize jQuery datatables */
19 19 public define List(HTML_Head_Tag)
20   - jquery_datatables_init
  20 + jquery_datatables_1_9_init
21 21 (
22 22 String web_dir,
23 23 )
24 24 =
25 25 [
26   - css(css_file("/css/jquery/jquery.dataTables.css")),
  26 + css(css_file("css/jquery/jquery.dataTables.css")),
27 27 css(css_file("/css/jquery/jquery.dataTables_themeroller.css")),
28 28 js(js_file("/js/jquery/jquery.dataTables.js")),
29 29 //js(js_file("js/jquery/dataTables/dataTables.jqueryui.js")) , only for datatable 1.10
... ... @@ -35,6 +35,24 @@ public define List(HTML_Head_Tag)
35 35 ]
36 36 .
37 37  
  38 +public define List(HTML_Head_Tag)
  39 + jquery_datatables_1_10_init
  40 +// (
  41 +// String web_dir,
  42 +// )
  43 + =
  44 + [
  45 + //css(css_file("jquery/plug-in/DataTables-1.10.7/media/css/jquery.dataTables.min.css")),
  46 + //css(css_file("jquery/plug-in/DataTables-1.10.7/media/css/jquery.dataTables_themeroller.css")),
  47 + js(js_file("jquery/plug-in/DataTables-1.10.7/media/js/jquery.dataTables.js")),
  48 + js(js_file("jquery/plug-in/DataTables-1.10.7/media/js/dataTables.jqueryui.js")) , //only for datatable 1.10
  49 + css(css_file("jquery/plug-in/DataTables-1.10.7/media/css/dataTables.jqueryui.css")), //only for datatable 1.10
  50 + css(css_file("jquery/plug-in/DataTables-1.10.7/extensions/Scroller/css/dataTables.scroller.min.css")),
  51 + js(js_file("jquery/plug-in/DataTables-1.10.7/extensions/Scroller/js/dataTables.scroller.js")),
  52 +// css(css_file("jquery/plug-in/DataTables-1.10.7/extensions/Responsive/css/dataTables.responsive.css")),
  53 +// js(js_file("jquery/plug-in/DataTables-1.10.7/extensions/responsive/js/dataTables.responsive.js")),
  54 + ]
  55 + .
38 56 public define HTML_Partial_Content
39 57 jquery_datatable
40 58 (
... ... @@ -42,7 +60,7 @@ public define HTML_Partial_Content
42 60 HTML_Off_Form table
43 61 )
44 62 =
45   - partial_content(
  63 + partial_content(jquery_datatables_1_10_init +
46 64 [ js_inline(jquery_ready("$('#"+table_id+"').dataTable();")) ],
47 65 table
48 66 )
... ... @@ -57,7 +75,7 @@ public define HTML_Partial_Content
57 75 )
58 76 =
59 77 if enable_jqueryui then
60   - partial_content(
  78 + partial_content( jquery_datatables_1_10_init +
61 79 [ js_inline(jquery_ready("$('#"+table_id+"').dataTable({\"bJQueryUI\":true});")) ],
62 80 table
63 81 )
... ... @@ -83,30 +101,32 @@ public define HTML_Partial_Content
83 101 String web_dir
84 102 )
85 103 =
86   - partial_content(
87   - [
88   - js_inline(jquery_ready("
89   - $('#"+table_id+"').dataTable(
90   - {
91   - \"bJQueryUI\":"+to_String(enable_jqueryui)+",
92   - \"sPaginationType\":'"+jquery_datatable_pagination_type_to_string(pagination_type)+"',
93   - \"bFilter\":"+to_String(enable_search_field)+",
94   - \"bPaginate\":"+to_String(enable_pagination)+","+
95   - if scrollY is
96   - {
97   - no_scroll then "",
98   - scrollY(size) then "\"sScrollY\": \""+size+"px\","
99   - }+
100   - "\"bStateSave\": true,
101   - \"bLengthChange\":"+to_String(enable_change_page_length)+",
102   - \"bSort\":"+to_String(enable_columns_sorting)+","+
103   - get_datatable_translation(lang, web_dir)+
104   - jquery_datatable_extra_to_string(extra)+
105   - "});
106   - "
107   - )
108   - )
109   - ],
  104 + partial_content( jquery_datatables_1_10_init +
  105 + [
  106 + js_inline(jquery_ready("
  107 + $('#"+table_id+"').dataTable(
  108 + {
  109 + \"jQueryUI\":"+to_String(enable_jqueryui)+",
  110 + \"sPaginationType\":'"+jquery_datatable_pagination_type_to_string(pagination_type)+"',
  111 + \"bFilter\":"+to_String(enable_search_field)+",
  112 + \"bPaginate\":"+to_String(enable_pagination)+","+
  113 + // responsive: true,"+
  114 +
  115 + if scrollY is
  116 + {
  117 + no_scroll then "",
  118 + scrollY(size) then "\"sScrollY\": \""+size+"px\","
  119 + }+
  120 + "\"bStateSave\": true,
  121 + \"bLengthChange\":"+to_String(enable_change_page_length)+",
  122 + \"bSort\":"+to_String(enable_columns_sorting)+","+
  123 + get_datatable_translation(lang, web_dir)+
  124 + jquery_datatable_extra_to_string(extra)+
  125 + "});
  126 + "
  127 + )
  128 + )
  129 + ],
110 130 table
111 131 )
112 132 .
... ...
web/jQuery/CXM_jquery_datatable_server_side.anubis
... ... @@ -17,13 +17,14 @@ public define Maybe(JQuery_datatable_server_side_type)
17 17 List(Web_arg) lwa
18 18 )=
19 19  
20   - if get_String(lwa, "sEcho") is {failure then failure, success(secho) then
21   - if get_Int(lwa, "iColumns") is {failure then failure, success(icolumns) then
22   - if get_String(lwa, "sColumns") is {failure then failure, success(scolumns) then
23   - if get_Int(lwa, "iDisplayStart") is {failure then failure, success(idisplaystart) then
24   - if get_Int(lwa, "iDisplayLength") is {failure then failure, success(idisplaylength) then
25   - if get_String(lwa, "sSearch") is {failure then failure, success(sSearch) then
  20 + if get_String(lwa, "sEcho") is {failure then println("can't read sEcho");failure, success(secho) then
  21 + if get_Int(lwa, "iColumns") is {failure then println("can't read iColumns");failure, success(icolumns) then
  22 + if get_String(lwa, "sColumns") is {failure then println("can't read sColumns");failure, success(scolumns) then
  23 + if get_Int(lwa, "iDisplayStart") is {failure then println("can't read iDisplayStart");failure, success(idisplaystart) then
  24 + if get_Int(lwa, "iDisplayLength") is {failure then println("can't read iDisplayLength");failure, success(idisplaylength) then
  25 + if get_String(lwa, "sSearch") is {failure then println("can't read sSearch");failure, success(sSearch) then
26 26 // if get_String(lwa, "sSortDir") is {failure then failure, success(sSortDir) then
27 27 success(dt_ss(secho, icolumns, scolumns, idisplaystart, idisplaylength, if sSearch = "" then failure else success(sSearch)))
28 28 }}}}}}.
29 29  
  30 +
... ...