Commit f5d1263a authored by Sven Franck's avatar Sven Franck

fixed search results filtering/sorting using jIO

parent f5f224c7
......@@ -83,7 +83,8 @@ div.ui-body h2 { margin: 0.5em 0 0; }
/* increase padding for iconpos-notext buttons */
/* BUTTONS - optional - Increase padding for icon-only buttons - just too difficult to click them */
.ui-btn-icon-notext:not(.no-pad) { height: 30px; width: 30px; }
.ui-btn-icon-notext:not(.no-pad) .ui-btn-inner { padding: 3px 3px !important; }
.ui-btn.ui-input-clear { margin: -16px 4px 0 0; }
.ui-btn-icon-notext:not(.no-pad) .ui-btn-inner { padding: 0.25em 3px; }
.ui-fullscreen-mode .ui-btn-icon-notext:not(.no-pad) .ui-btn-inner { padding: 2px 3px !important; /* 4px 5px */ }
.ui-controlgroup-horizontal .ui-btn, .ui-controlgroup-horizontal .ui-select { vertical-align: middle; }
......
{}
\ No newline at end of file
{}
\ No newline at end of file
[
{"mech":"COMP-1354", "provider":"AtlanticNet"},
{"mech":"COMP-1288", "provider":"Rackspace_Dallas"},
{"mech":"COMP-1394", "provider":"Atlantic.Net"},
{"mech":"COMP-1395", "provider":"vmWare.vCloud"},
{"mech":"COMP-1283", "provider":"Azure_WestUS"},
{"mech":"COMP-1393", "provider":"Joyent_USEast1"},
{"mech":"COMP-1392", "provider":"Azure_East_US"},
{"mech":"COMP-156", "provider":"ERP5-TEST-NODE-DS61-XA"},
{"mech":"COMP-1286", "provider":"AWS_US-EAST-1c"}
]
\ No newline at end of file
{"COMP-17": {"totaltime": "1123202.0", "init": "2012-11-29T00:00:04", "percentile": "15.503355585193049", "last": "2012-12-12T00:00:06", "machine_downtime": "949068.0"}, "COMP-743": {"totaltime": "1198132.0", "init": "2012-11-28T13:32:39", "percentile": "48.369044479239356", "last": "2012-12-12T10:21:31", "machine_downtime": "618607.0"}, "COMP-1042": {"totaltime": "1197907.0", "init": "2012-11-28T13:35:02", "percentile": "39.62118929098837", "last": "2012-12-12T10:20:09", "machine_downtime": "723282.0"}, "COMP-742": {"totaltime": "1197718.0", "init": "2012-11-28T13:39:33", "percentile": "64.19148747868864", "last": "2012-12-12T10:21:31", "machine_downtime": "428885.0"}, "COMP-388": {"totaltime": "0.0", "init": "2012-12-03T09:03:10", "percentile": "100", "last": "2012-12-03T09:03:10", "machine_downtime": "0"}, "COMP-1165": {"totaltime": "2666.0", "init": "2012-11-28T17:59:02", "percentile": "20.255063765941486", "last": "2012-11-28T18:43:28", "machine_downtime": "2126.0"}, "COMP-1166": {"totaltime": "0.0", "init": "2012-11-28T18:02:04", "percentile": "100", "last": "2012-11-28T18:02:04", "machine_downtime": "0"}, "COMP-189": {"totaltime": "1197900.0", "init": "2012-11-28T13:35:02", "percentile": "40.44194006177477", "last": "2012-12-12T10:20:02", "machine_downtime": "713446.0"}, "COMP-869": {"totaltime": "1198095.0", "init": "2012-11-28T13:32:48", "percentile": "70.98785989424879", "last": "2012-12-12T10:21:03", "machine_downtime": "347593.0"}, "COMP-672": {"totaltime": "1198141.0", "init": "2012-11-28T13:33:02", "percentile": "95.59525965641774", "last": "2012-12-12T10:22:03", "machine_downtime": "52775.0"}, "COMP-776": {"totaltime": "1198139.0", "init": "2012-11-28T13:33:02", "percentile": "99.66281040847514", "last": "2012-12-12T10:22:01", "machine_downtime": "4040.0"}, "COMP-777": {"totaltime": "1198141.0", "init": "2012-11-28T13:33:01", "percentile": "99.19391791116405", "last": "2012-12-12T10:22:02", "machine_downtime": "9658.0"}, "COMP-227": {"totaltime": "1197960.0", "init": "2012-11-28T13:32:36", "percentile": "45.96438946208554", "last": "2012-12-12T10:18:36", "machine_downtime": "647325.0"}, "COMP-730": {"totaltime": "1198164.0", "init": "2012-11-28T13:33:01", "percentile": "99.99524272136368", "last": "2012-12-12T10:22:25", "machine_downtime": "57.0"}, "COMP-185": {"totaltime": "1197272.0", "init": "2012-11-28T13:47:29", "percentile": "58.44227543949913", "last": "2012-12-12T10:22:01", "machine_downtime": "497559.0"}, "COMP-734": {"totaltime": "1198100.0", "init": "2012-11-28T13:32:35", "percentile": "79.5458642851181", "last": "2012-12-12T10:20:55", "machine_downtime": "245061.0"}, "COMP-1139": {"totaltime": "1198142.0", "init": "2012-11-28T13:33:01", "percentile": "99.62433501204364", "last": "2012-12-12T10:22:03", "machine_downtime": "4501.0"}, "COMP-1171": {"totaltime": "600.0", "init": "2012-11-28T18:14:01", "percentile": "100", "last": "2012-11-28T18:24:01", "machine_downtime": "0"}, "COMP-1172": {"totaltime": "1178460.0", "init": "2012-11-28T19:01:02", "percentile": "99.99932114793883", "last": "2012-12-12T10:22:02", "machine_downtime": "8.0"}, "COMP-1132": {"totaltime": "939908.0", "init": "2012-11-29T00:45:05", "percentile": "37.01819752571528", "last": "2012-12-09T21:50:13", "machine_downtime": "591971.0"}, "COMP-1170": {"totaltime": "1028464.0", "init": "2012-11-28T18:25:01", "percentile": "67.14449898100469", "last": "2012-12-10T16:06:05", "machine_downtime": "337907.0"}, "COMP-1078": {"totaltime": "1198139.0", "init": "2012-11-28T13:33:02", "percentile": "100", "last": "2012-12-12T10:22:01", "machine_downtime": "0"}, "COMP-839": {"totaltime": "1197900.0", "init": "2012-11-28T13:35:03", "percentile": "40.21420819767927", "last": "2012-12-12T10:20:03", "machine_downtime": "716174.0"}, "COMP-1115": {"totaltime": "1196644.0", "init": "2012-11-28T13:33:02", "percentile": "52.73648637355805", "last": "2012-12-12T09:57:06", "machine_downtime": "565576.0"}, "COMP-26": {"totaltime": "1198234.0", "init": "2012-11-28T13:32:15", "percentile": "95.2153752939743", "last": "2012-12-12T10:22:49", "machine_downtime": "57331.0"}, "COMP-1176": {"totaltime": "960.0", "init": "2012-11-29T13:15:02", "percentile": "31.770833333333343", "last": "2012-11-29T13:31:02", "machine_downtime": "655.0"}, "COMP-979": {"totaltime": "689147.0", "init": "2012-12-04T10:56:16", "percentile": "90.63276775492021", "last": "2012-12-12T10:22:03", "machine_downtime": "64554.0"}, "COMP-791": {"totaltime": "1140124.0", "init": "2012-11-28T13:33:01", "percentile": "70.92746052183797", "last": "2012-12-11T18:15:05", "machine_downtime": "331463.0"}, "COMP-1179": {"totaltime": "71943.0", "init": "2012-11-29T13:39:02", "percentile": "100", "last": "2012-11-30T09:38:05", "machine_downtime": "0"}, "COMP-1175": {"totaltime": "180.0", "init": "2012-11-29T13:11:02", "percentile": "100", "last": "2012-11-29T13:14:02", "machine_downtime": "0"}, "COMP-132": {"totaltime": "1031441.0", "init": "2012-11-30T11:40:55", "percentile": "93.16092728522523", "last": "2012-12-12T10:11:36", "machine_downtime": "70541.0"}, "COMP-25": {"totaltime": "1198196.0", "init": "2012-11-28T13:32:15", "percentile": "99.76155820917445", "last": "2012-12-12T10:22:11", "machine_downtime": "2857.0"}, "COMP-24": {"totaltime": "604657.0", "init": "2012-12-01T20:37:21", "percentile": "100", "last": "2012-12-08T20:34:58", "machine_downtime": "0"}, "COMP-1188": {"totaltime": "621180.0", "init": "2012-12-03T10:45:03", "percentile": "100", "last": "2012-12-10T15:18:03", "machine_downtime": "0"}, "COMP-171": {"totaltime": "683092.0", "init": "2012-12-01T14:51:39", "percentile": "100", "last": "2012-12-09T12:36:31", "machine_downtime": "0"}, "COMP-1187": {"totaltime": "181.0", "init": "2012-12-03T10:41:01", "percentile": "100", "last": "2012-12-03T10:44:02", "machine_downtime": "0"}, "COMP-1186": {"totaltime": "0.0", "init": "2012-12-03T10:40:02", "percentile": "100", "last": "2012-12-03T10:40:02", "machine_downtime": "0"}, "COMP-1180": {"totaltime": "240.0", "init": "2012-11-30T11:56:03", "percentile": "100", "last": "2012-11-30T12:00:03", "machine_downtime": "0"}, "COMP-233": {"totaltime": "1197901.0", "init": "2012-11-28T13:35:01", "percentile": "40.45901956839505", "last": "2012-12-12T10:20:02", "machine_downtime": "713242.0"}, "COMP-1182": {"totaltime": "537062.0", "init": "2012-11-30T12:01:02", "percentile": "61.879447810494874", "last": "2012-12-06T17:12:04", "machine_downtime": "204731.0"}, "COMP-886": {"totaltime": "433420.0", "init": "2012-12-06T17:09:45", "percentile": "17.486502699460104", "last": "2012-12-11T17:33:25", "machine_downtime": "357630.0"}, "COMP-726": {"totaltime": "1198145.0", "init": "2012-11-28T13:33:01", "percentile": "99.99849767766005", "last": "2012-12-12T10:22:06", "machine_downtime": "18.0"}, "COMP-725": {"totaltime": "1198232.0", "init": "2012-11-28T13:32:15", "percentile": "99.99933234966184", "last": "2012-12-12T10:22:47", "machine_downtime": "8.0"}, "COMP-724": {"totaltime": "1198179.0", "init": "2012-11-28T13:32:24", "percentile": "99.98497720290541", "last": "2012-12-12T10:22:03", "machine_downtime": "180.0"}, "COMP-536": {"totaltime": "1198141.0", "init": "2012-11-28T13:33:02", "percentile": "99.9949087795176", "last": "2012-12-12T10:22:03", "machine_downtime": "61.0"}, "COMP-629": {"totaltime": "1197943.0", "init": "2012-11-28T13:34:53", "percentile": "65.48116229236282", "last": "2012-12-12T10:20:36", "machine_downtime": "413516.0"}, "COMP-729": {"totaltime": "1198142.0", "init": "2012-11-28T13:33:01", "percentile": "99.99507570888926", "last": "2012-12-12T10:22:03", "machine_downtime": "59.0"}, "COMP-373": {"totaltime": "1198167.0", "init": "2012-11-28T13:32:53", "percentile": "53.25576484747118", "last": "2012-12-12T10:22:20", "machine_downtime": "560074.0"}, "COMP-921": {"totaltime": "1050680.0", "init": "2012-11-28T13:32:28", "percentile": "99.84819355084326", "last": "2012-12-10T17:23:48", "machine_downtime": "1595.0"}, "COMP-920": {"totaltime": "1123144.0", "init": "2012-11-29T00:01:26", "percentile": "15.484390247377007", "last": "2012-12-12T00:00:30", "machine_downtime": "949232.0"}, "COMP-922": {"totaltime": "1123191.0", "init": "2012-11-29T09:32:46", "percentile": "22.503830604055764", "last": "2012-12-12T09:32:37", "machine_downtime": "870430.0"}, "COMP-482": {"totaltime": "1198190.0", "init": "2012-11-28T13:33:02", "percentile": "99.94007628172494", "last": "2012-12-12T10:22:52", "machine_downtime": "718.0"}, "COMP-1090": {"totaltime": "1198184.0", "init": "2012-11-28T13:32:18", "percentile": "99.98948408591669", "last": "2012-12-12T10:22:02", "machine_downtime": "126.0"}, "COMP-806": {"totaltime": "1198195.0", "init": "2012-11-28T13:33:02", "percentile": "99.69161947763094", "last": "2012-12-12T10:22:57", "machine_downtime": "3695.0"}, "COMP-968": {"totaltime": "718782.0", "init": "2012-11-28T15:16:15", "percentile": "39.93658717107551", "last": "2012-12-06T22:55:57", "machine_downtime": "431725.0"}, "COMP-1061": {"totaltime": "1197926.0", "init": "2012-11-28T13:35:42", "percentile": "48.67412511290347", "last": "2012-12-12T10:21:08", "machine_downtime": "614846.0"}, "COMP-840": {"totaltime": "1198140.0", "init": "2012-11-28T13:33:05", "percentile": "63.37873704241574", "last": "2012-12-12T10:22:05", "machine_downtime": "438774.0"}, "COMP-800": {"totaltime": "1198143.0", "init": "2012-11-28T13:33:01", "percentile": "93.25497874627654", "last": "2012-12-12T10:22:04", "machine_downtime": "80815.0"}, "COMP-747": {"totaltime": "1198145.0", "init": "2012-11-28T13:33:02", "percentile": "93.94672598057831", "last": "2012-12-12T10:22:07", "machine_downtime": "72527.0"}, "COMP-728": {"totaltime": "1198143.0", "init": "2012-11-28T13:33:01", "percentile": "99.99624418788075", "last": "2012-12-12T10:22:04", "machine_downtime": "45.0"}, "COMP-121": {"totaltime": "1087766.0", "init": "2012-11-29T08:08:35", "percentile": "9.04155857050138", "last": "2012-12-11T22:18:01", "machine_downtime": "989415.0"}, "COMP-257": {"totaltime": "1123202.0", "init": "2012-11-29T01:00:52", "percentile": "15.503266554012555", "last": "2012-12-12T01:00:54", "machine_downtime": "949069.0"}, "COMP-161": {"totaltime": "841970.0", "init": "2012-11-30T09:52:52", "percentile": "39.13678634630687", "last": "2012-12-10T03:45:42", "machine_downtime": "512450.0"}, "COMP-374": {"totaltime": "1198239.0", "init": "2012-11-28T13:32:17", "percentile": "76.24697577027621", "last": "2012-12-12T10:22:56", "machine_downtime": "284618.0"}, "COMP-13": {"totaltime": "61506.0", "init": "2012-12-06T09:50:02", "percentile": "42.3080675056092", "last": "2012-12-07T02:55:08", "machine_downtime": "35484.0"}, "COMP-165": {"totaltime": "1050644.0", "init": "2012-11-28T13:33:01", "percentile": "93.4923722973719", "last": "2012-12-10T17:23:45", "machine_downtime": "68372.0"}, "COMP-533": {"totaltime": "1198145.0", "init": "2012-11-28T13:33:01", "percentile": "99.99490879651461", "last": "2012-12-12T10:22:06", "machine_downtime": "61.0"}, "COMP-1093": {"totaltime": "1198140.0", "init": "2012-11-28T13:33:04", "percentile": "99.77982539603052", "last": "2012-12-12T10:22:04", "machine_downtime": "2638.0"}, "COMP-1196": {"totaltime": "600911.0", "init": "2012-12-05T11:27:47", "percentile": "46.32582861688337", "last": "2012-12-12T10:22:58", "machine_downtime": "322534.0"}, "COMP-751": {"totaltime": "1146573.0", "init": "2012-11-29T03:52:31", "percentile": "33.38252339798687", "last": "2012-12-12T10:22:04", "machine_downtime": "763818.0"}, "COMP-998": {"totaltime": "689029.0", "init": "2012-12-04T10:58:12", "percentile": "90.48893442801392", "last": "2012-12-12T10:22:01", "machine_downtime": "65534.0"}, "COMP-999": {"totaltime": "689154.0", "init": "2012-12-04T10:56:08", "percentile": "90.53535204032771", "last": "2012-12-12T10:22:02", "machine_downtime": "65226.0"}, "COMP-1197": {"totaltime": "459379.0", "init": "2012-12-07T02:43:49", "percentile": "41.27223926213431", "last": "2012-12-12T10:20:08", "machine_downtime": "269783.0"}, "COMP-994": {"totaltime": "689096.0", "init": "2012-12-04T10:57:07", "percentile": "90.68925084458479", "last": "2012-12-12T10:22:03", "machine_downtime": "64160.0"}, "COMP-995": {"totaltime": "689093.0", "init": "2012-12-04T10:57:11", "percentile": "90.66366949018493", "last": "2012-12-12T10:22:04", "machine_downtime": "64336.0"}, "COMP-996": {"totaltime": "568925.0", "init": "2012-12-05T20:19:56", "percentile": "97.98479588697982", "last": "2012-12-12T10:22:01", "machine_downtime": "11465.0"}, "COMP-997": {"totaltime": "689032.0", "init": "2012-12-04T10:58:10", "percentile": "90.32788027261434", "last": "2012-12-12T10:22:02", "machine_downtime": "66644.0"}, "COMP-455": {"totaltime": "1197899.0", "init": "2012-11-28T13:34:35", "percentile": "40.09019124316825", "last": "2012-12-12T10:19:34", "machine_downtime": "717659.0"}, "COMP-991": {"totaltime": "1198236.0", "init": "2012-11-28T13:32:18", "percentile": "51.143097019285015", "last": "2012-12-12T10:22:54", "machine_downtime": "585421.0"}, "COMP-992": {"totaltime": "17340.0", "init": "2012-12-04T10:56:06", "percentile": "100", "last": "2012-12-04T15:45:06", "machine_downtime": "0"}, "COMP-993": {"totaltime": "689089.0", "init": "2012-12-04T10:57:12", "percentile": "90.46117410087811", "last": "2012-12-12T10:22:01", "machine_downtime": "65731.0"}, "COMP-9": {"totaltime": "1198128.0", "init": "2012-11-28T13:33:48", "percentile": "63.68100904077027", "last": "2012-12-12T10:22:36", "machine_downtime": "435148.0"}, "COMP-148": {"totaltime": "830164.0", "init": "2012-12-02T19:00:47", "percentile": "55.3890556564727", "last": "2012-12-12T09:36:51", "machine_downtime": "370344.0"}, "COMP-712": {"totaltime": "1198181.0", "init": "2012-11-28T13:33:08", "percentile": "99.44691161018244", "last": "2012-12-12T10:22:49", "machine_downtime": "6627.0"}, "COMP-202": {"totaltime": "1198186.0", "init": "2012-11-28T13:32:17", "percentile": "99.69837738047349", "last": "2012-12-12T10:22:03", "machine_downtime": "3614.0"}, "COMP-31": {"totaltime": "1197994.0", "init": "2012-11-28T13:36:06", "percentile": "39.23533840737099", "last": "2012-12-12T10:22:40", "machine_downtime": "727957.0"}, "COMP-0": {"totaltime": "1198135.0", "init": "2012-11-28T13:33:08", "percentile": "48.188058941605085", "last": "2012-12-12T10:22:03", "machine_downtime": "620777.0"}, "COMP-1192": {"totaltime": "588255.0", "init": "2012-12-04T17:31:53", "percentile": "82.08821004496349", "last": "2012-12-11T12:56:08", "machine_downtime": "105367.0"}, "COMP-2": {"totaltime": "1198219.0", "init": "2012-11-28T13:32:39", "percentile": "96.11832227664559", "last": "2012-12-12T10:22:58", "machine_downtime": "46511.0"}, "COMP-5": {"totaltime": "1197773.0", "init": "2012-11-28T13:34:20", "percentile": "48.48389469457067", "last": "2012-12-12T10:17:13", "machine_downtime": "617046.0"}, "COMP-6": {"totaltime": "1198033.0", "init": "2012-11-28T13:34:43", "percentile": "64.2150925725752", "last": "2012-12-12T10:21:56", "machine_downtime": "428715.0"}, "COMP-1116": {"totaltime": "1015570.0", "init": "2012-11-28T14:41:03", "percentile": "59.778941875006154", "last": "2012-12-10T08:47:13", "machine_downtime": "408473.0"}, "COMP-1158": {"totaltime": "589320.0", "init": "2012-11-28T13:33:03", "percentile": "85.5519921265187", "last": "2012-12-05T09:15:03", "machine_downtime": "85145.0"}, "COMP-812": {"totaltime": "1198187.0", "init": "2012-11-28T13:33:05", "percentile": "99.66599537467857", "last": "2012-12-12T10:22:52", "machine_downtime": "4002.0"}, "COMP-1112": {"totaltime": "1111489.0", "init": "2012-11-29T04:56:02", "percentile": "58.8730072902206", "last": "2012-12-12T01:40:51", "machine_downtime": "457122.0"}, "COMP-1190": {"totaltime": "86943.0", "init": "2012-12-04T12:46:02", "percentile": "99.95169248818192", "last": "2012-12-05T12:55:05", "machine_downtime": "42.0"}, "COMP-798": {"totaltime": "1189082.0", "init": "2012-11-28T15:26:51", "percentile": "7.819982137480849", "last": "2012-12-12T09:44:53", "machine_downtime": "1096096.0"}, "COMP-1111": {"totaltime": "1153135.0", "init": "2012-11-28T13:33:02", "percentile": "43.43489704154327", "last": "2012-12-11T21:51:57", "machine_downtime": "652272.0"}, "COMP-1150": {"totaltime": "75610.0", "init": "2012-11-28T13:36:01", "percentile": "37.87461975929109", "last": "2012-11-29T10:36:11", "machine_downtime": "46973.0"}, "COMP-1001": {"totaltime": "689218.0", "init": "2012-12-04T10:55:03", "percentile": "90.36719876729859", "last": "2012-12-12T10:22:01", "machine_downtime": "66391.0"}, "COMP-1157": {"totaltime": "2996.0", "init": "2012-11-28T13:35:09", "percentile": "40.78771695594126", "last": "2012-11-28T14:25:05", "machine_downtime": "1774.0"}, "COMP-1118": {"totaltime": "1069702.0", "init": "2012-11-29T09:25:02", "percentile": "49.41292060779544", "last": "2012-12-11T18:33:24", "machine_downtime": "541131.0"}, "COMP-1119": {"totaltime": "1198186.0", "init": "2012-11-28T13:32:16", "percentile": "43.652738389532175", "last": "2012-12-12T10:22:02", "machine_downtime": "675145.0"}, "COMP-547": {"totaltime": "1198196.0", "init": "2012-11-28T13:32:52", "percentile": "100", "last": "2012-12-12T10:22:48", "machine_downtime": "0"}, "COMP-390": {"totaltime": "1198194.0", "init": "2012-11-28T13:33:02", "percentile": "60.68541488273185", "last": "2012-12-12T10:22:56", "machine_downtime": "471065.0"}, "COMP-707": {"totaltime": "1198180.0", "init": "2012-11-28T13:32:23", "percentile": "99.38114473618322", "last": "2012-12-12T10:22:03", "machine_downtime": "7415.0"}, "COMP-297": {"totaltime": "1078412.0", "init": "2012-11-28T16:42:35", "percentile": "27.564789709313317", "last": "2012-12-11T04:16:07", "machine_downtime": "781150.0"}, "COMP-1159": {"totaltime": "1041447.0", "init": "2012-11-29T10:55:42", "percentile": "97.39295422618721", "last": "2012-12-11T12:13:09", "machine_downtime": "27151.0"}, "COMP-1062": {"totaltime": "1198146.0", "init": "2012-11-28T13:33:41", "percentile": "72.39768776092396", "last": "2012-12-12T10:22:47", "machine_downtime": "330716.0"}, "COMP-1086": {"totaltime": "1198196.0", "init": "2012-11-28T13:32:52", "percentile": "100", "last": "2012-12-12T10:22:48", "machine_downtime": "0"}, "COMP-1087": {"totaltime": "1198228.0", "init": "2012-11-28T13:32:15", "percentile": "99.88549758476684", "last": "2012-12-12T10:22:43", "machine_downtime": "1372.0"}, "COMP-156": {"totaltime": "669240.0", "init": "2012-12-04T16:28:26", "percentile": "99.2200107584723", "last": "2012-12-12T10:22:26", "machine_downtime": "5220.0"}, "COMP-807": {"totaltime": "1198143.0", "init": "2012-11-28T13:33:01", "percentile": "99.65613453485936", "last": "2012-12-12T10:22:04", "machine_downtime": "4120.0"}, "COMP-701": {"totaltime": "1198182.0", "init": "2012-11-28T13:32:24", "percentile": "97.8575041187399", "last": "2012-12-12T10:22:06", "machine_downtime": "25671.0"}, "COMP-859": {"totaltime": "1198139.0", "init": "2012-11-28T13:33:04", "percentile": "99.74343544446846", "last": "2012-12-12T10:22:03", "machine_downtime": "3074.0"}, "COMP-703": {"totaltime": "1198234.0", "init": "2012-11-28T13:32:16", "percentile": "99.1888061931142", "last": "2012-12-12T10:22:50", "machine_downtime": "9720.0"}, "COMP-749": {"totaltime": "1198127.0", "init": "2012-11-28T13:33:22", "percentile": "64.06733176032257", "last": "2012-12-12T10:22:09", "machine_downtime": "430519.0"}, "COMP-704": {"totaltime": "1198236.0", "init": "2012-11-28T13:32:21", "percentile": "98.384375031296", "last": "2012-12-12T10:22:57", "machine_downtime": "19359.0"}, "COMP-1200": {"totaltime": "85446.0", "init": "2012-12-10T14:21:03", "percentile": "60.634786882943615", "last": "2012-12-11T14:05:09", "machine_downtime": "33636.0"}, "COMP-706": {"totaltime": "1198183.0", "init": "2012-11-28T13:32:19", "percentile": "97.64735436907384", "last": "2012-12-12T10:22:02", "machine_downtime": "28189.0"}, "COMP-1076": {"totaltime": "7121.0", "init": "2012-12-04T13:20:40", "percentile": "66.22665355989326", "last": "2012-12-04T15:19:21", "machine_downtime": "2405.0"}, "COMP-1128": {"totaltime": "1197601.0", "init": "2012-11-28T13:39:08", "percentile": "27.390257690165583", "last": "2012-12-12T10:19:09", "machine_downtime": "869575.0"}, "COMP-550": {"totaltime": "1198022.0", "init": "2012-11-28T13:33:50", "percentile": "63.06169669672176", "last": "2012-12-12T10:20:52", "machine_downtime": "442529.0"}, "COMP-710": {"totaltime": "1198240.0", "init": "2012-11-28T13:32:18", "percentile": "82.5716884764321", "last": "2012-12-12T10:22:58", "machine_downtime": "208833.0"}, "COMP-708": {"totaltime": "1198141.0", "init": "2012-11-28T13:33:02", "percentile": "97.89398743553555", "last": "2012-12-12T10:22:03", "machine_downtime": "25233.0"}, "COMP-1004": {"totaltime": "689400.0", "init": "2012-12-04T10:52:02", "percentile": "90.59515520742674", "last": "2012-12-12T10:22:02", "machine_downtime": "64837.0"}, "COMP-1005": {"totaltime": "689872.0", "init": "2012-12-04T10:44:09", "percentile": "90.39184080525084", "last": "2012-12-12T10:22:01", "machine_downtime": "66284.0"}, "COMP-1000": {"totaltime": "689153.0", "init": "2012-12-04T10:56:09", "percentile": "90.5624730647621", "last": "2012-12-12T10:22:02", "machine_downtime": "65039.0"}, "COMP-256": {"totaltime": "1123199.0", "init": "2012-11-29T01:00:42", "percentile": "15.50170539681747", "last": "2012-12-12T01:00:41", "machine_downtime": "949084.0"}, "COMP-1002": {"totaltime": "689218.0", "init": "2012-12-04T10:55:04", "percentile": "90.5597358165341", "last": "2012-12-12T10:22:02", "machine_downtime": "65064.0"}, "COMP-1003": {"totaltime": "689218.0", "init": "2012-12-04T10:55:03", "percentile": "90.5069223380701", "last": "2012-12-12T10:22:01", "machine_downtime": "65428.0"}, "COMP-781": {"totaltime": "1198193.0", "init": "2012-11-28T13:33:01", "percentile": "99.7446154334068", "last": "2012-12-12T10:22:54", "machine_downtime": "3060.0"}, "COMP-780": {"totaltime": "1050635.0", "init": "2012-11-28T13:33:02", "percentile": "99.79764618540216", "last": "2012-12-10T17:23:37", "machine_downtime": "2126.0"}, "COMP-905": {"totaltime": "1198141.0", "init": "2012-11-28T13:33:01", "percentile": "98.62587124553788", "last": "2012-12-12T10:22:02", "machine_downtime": "16464.0"}, "COMP-903": {"totaltime": "1198140.0", "init": "2012-11-28T13:33:02", "percentile": "99.71555911663077", "last": "2012-12-12T10:22:02", "machine_downtime": "3408.0"}, "COMP-1167": {"totaltime": "422.0", "init": "2012-11-28T18:03:02", "percentile": "100", "last": "2012-11-28T18:10:04", "machine_downtime": "0"}, "COMP-1169": {"totaltime": "359.0", "init": "2012-11-28T18:07:02", "percentile": "100", "last": "2012-11-28T18:13:01", "machine_downtime": "0"}, "COMP-1168": {"totaltime": "401221.0", "init": "2012-11-28T18:11:02", "percentile": "99.09825258398737", "last": "2012-12-03T09:38:03", "machine_downtime": "3618.0"}, "COMP-12": {"totaltime": "9389.0", "init": "2012-12-07T12:18:12", "percentile": "59.63361380338694", "last": "2012-12-07T14:54:41", "machine_downtime": "3790.0"}, "COMP-942": {"totaltime": "1044723.0", "init": "2012-11-29T10:29:42", "percentile": "32.670765360770275", "last": "2012-12-11T12:41:45", "machine_downtime": "703404.0"}, "COMP-10": {"totaltime": "1198121.0", "init": "2012-11-28T13:32:18", "percentile": "65.87339676042737", "last": "2012-12-12T10:20:59", "machine_downtime": "408878.0"}, "COMP-1164": {"totaltime": "59.0", "init": "2012-11-28T17:57:03", "percentile": "100", "last": "2012-11-28T17:58:02", "machine_downtime": "0"}, "COMP-1162": {"totaltime": "659222.0", "init": "2012-11-28T18:05:03", "percentile": "67.20361274350674", "last": "2012-12-06T09:12:05", "machine_downtime": "216201.0"}, "COMP-1161": {"totaltime": "597.0", "init": "2012-11-28T17:46:05", "percentile": "100", "last": "2012-11-28T17:56:02", "machine_downtime": "0"}}
\ No newline at end of file
......@@ -25,7 +25,7 @@
<script type="text/javascript" language="javascript">
//<![CDATA[
var gadget = RenderJs.getSelfGadget(), i,
var gadget = RenderJs.getSelfGadget(),
recursive_gadgets = gadget.dom.find("[data-gadget]").not(".main-interactor"),
len = recursive_gadgets.length;
......@@ -57,7 +57,7 @@
}
}
}
// interactions
gadget.translate = function(){
$.fn.util.lang(gadget.dom);
......
......@@ -5,7 +5,7 @@
//_gaq.push(['b._setAccount', <user_id>]);
trigAnalytics = function( trigger ){
$(document).on('pageshow','div:jqmData(role="page").basePage',
$(document).on('pageshow','div:jqmData(role="page")',
function (event, ui) {
var url = location.href;
try {
......@@ -29,7 +29,7 @@
$(document).ajaxSend(function(event, xhr, settings){
_gaq.push(['_trackPageview', settings.url]);
// if in app-mode
_gaq.push(['b._trackPageview', settings.url]);
//_gaq.push(['b._trackPageview', settings.url]);
});
}
};
......
<!DOCTYPE html>
<head>
<!-- <link rel="stylesheet" type="text/css" href="../js/plugins/jqplot/jquery.jqplot.min.css" /> -->
<style type="text/css">
/* search_criteria */
.search_info {text-align: center;}
......@@ -17,6 +16,7 @@
.results_wrapper .image_wrapper {max-height: 80px; text-align: center; padding: 0; display: block;}
.results_wrapper .image_wrapper img {max-height: inherit;}
.results_wrapper .provider_name {text-align: center;}
.results_wrapper tr {height: 52px; min-height: 52px;}
/* popups */
.ui-collapsible-popup {padding: 0;}
......@@ -42,12 +42,12 @@
<div class="ui-body ui-body-d results_wrapper ui-corner-all">
<div data-slot="true" data-slot-id="1">
<label for="a" data-i18n="results.sorting" class="select">Sort</label>
<label for="form_results_sort" data-i18n="results.sorting" class="select">Sort</label>
<select data-theme="f" id="form_results_sort" name="form_results_sort">
<option value="sort_az" data-i18n="results.sort.az" selected="selected" data-placeholder="true">A>Z</option>
<option value="sort_za" data-i18n="results.sort.za">Z>A</option>
<option value="sort_price_highest" data-i18n="results.sort.highest_price">Highest Price</option>
<option value="sort_price_lowest" data-i18n="results.sort.lowest_price">Lowest Price</option>
<option value="sort_provider_az" data-i18n="results.sort.az" selected="selected" data-placeholder="true">A>Z</option>
<option value="sort_provider_za" data-i18n="results.sort.za">Z>A</option>
<option value="sort_price_highest" disabled="disabled" data-i18n="results.sort.highest_price">Highest Price</option>
<option value="sort_price_lowest" disabled="disabled" data-i18n="results.sort.lowest_price">Lowest Price</option>
<option value="sort_score_highest" data-i18n="results.sort.highest_score">Highest Score</option>
<option value="sort_score_lowest" data-i18n="results.sort.highest_score">Lowest Score</option>
</select>
......@@ -56,152 +56,226 @@
<a href="index.html" data-transitions="slide" data-role="button" data-icon="back" data-iconpos="right" data-theme="b" class="t start_over" data-i18n-target=".ui-btn-text" data-i18n="[title]tx.start_over_info;[html]tx.start_over"></a>
</div>
<table class="ui-responsive table-stroke" data-filter-theme="c" data-role="table" id="results" data-mode="columntoggle" data-wrapper="c" data-filter-slot="2" data-top-container="true" data-bottom-container="true" data-filter="true">
<div data-slot="true" data-slot-id="4">
<label for="form_results_view" data-i18n="results.sorting" class="select">Sort</label>
<select data-theme="f" id="form_results_view" name="form_results_view">
<option value="display_list" class="t" data-i18n="results.display_list" selected="selected" data-placeholder="true">Show as list</option>
<option value="display_graph" class="t" data-i18n="results.display_graph">Vizualize</option>
</select>
</div>
<table class="ui-responsive table-stroke" data-filter-theme="c" id="results_table" data-mode="columntoggle" data-wrapper="c" data-filter-slot="2" data-top-container="true" data-bottom-container="true" data-filter="true">
<thead>
<tr>
<th data-priority="persist"><abbr class="t" data-i18n="[title]gen.provider_info;gen.provider;" title=""></abbr></th>
<th data-priority="4"><abbr class="t" data-i18n="[title]gen.provider_info;gen.provider;" title=""></abbr></th>
<th data-priority="persist"><abbr class="t" data-i18n="[title]gen.name;gen.name" title=""></abbr></th>
<th data-priority="4"><abbr class="t" data-i18n="[title]gen.data_info;gen.data" title=""></abbr></th>
<th data-priority="5"><abbr class="t" data-i18n="[title]gen.availability_info;gen.availability" title=""></abbr></th>
<th data-priority="6"><abbr class="t" data-i18n="[title]gen.price_info;gen.price;gen.price" title=""></abbr></th>
<th data-priority="persist"><abbr class="t" data-i18n="[title]gen.details_info;gen.details" title=""></abbr></th>
</tr>
</thead>
<tbody>
<tr>
<th><a href="#" title=""><span class="image_wrapper"><img src="../img/providers/ec2.png" alt=""></span></a><h2 class="provider_name small">Amazon EC2</h2></th>
<td><span class="key super key_loss">10<sup>-4</sup></span></td>
<td><span class="key super key_availability">99.2%</span></td>
<td><span class="key super key_cost">120€</span></td>
<td>
<a data-position-to="window" class="t scale-a" href="#provider_info_1" data-rel="popup" data-role="button" data-theme="c" data-icon="info" data-inline="true" data-i18n-target=".ui-btn-text" data-i18n="[title]gen.details_info;[html]gen.details"></a>
<div data-role="popup" id="provider_info_1" data-overlay-theme="a" data-theme="c" class="provider_popup ui-content ui-collapsible-popup">
<div data-role="collapsible-set" data-type="horizontal" data-theme="f" data-content-theme="c">
<div data-role="collapsible" data-collapsed-icon="arrow-d" data-expanded-icon="info" data-collapsed="false">
<h1>Load</h1>
</div>
<div data-role="collapsible" data-collapsed-icon="pulse" data-expanded-icon="info">
<h1>CPU</h1>
</div>
<div data-role="collapsible" data-collapsed="false" data-collapsed-icon="gear" data-expanded-icon="info">
<h1>DTB</h1>
<div data-theme="c" class="ui-body-c">
<div data-role="controlgroup" data-type="horizontal">
<input type="button" value="MySQLBench" name="results_dtb_sql" />
<input type="button" value="something else" name="results_dtb_postgre" />
</div>
<div id="chartdiv" style="height:400px;width:300px;"></div>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem </p>
</div>
</div>
<div data-role="collapsible" data-collapsed-icon="chat" data-expanded-icon="info">
<h1>Lang</h1>
</div>
<div data-role="collapsible" data-collapsed-icon="flash" data-expanded-icon="info">
<h1>IO</h1>
</div>
</div>
</div>
</td>
</tr>
<tr>
<tr>
<th><a href="#" title=""><span class="image_wrapper"><img src="../img/providers/ovh.png"></span></a><h2 class="provider_name small">OVH SP</h2></th>
<td><span class="key super key_loss">10<sup>-6</sup></span></td>
<td><span class="key super key_availability">99.82%</span></td>
<td><span class="key super key_cost">110€</span></td>
<td>
<a data-position-to="window" class="t scale-a" href="#provider_info_2" data-rel="popup" data-role="button" data-theme="c" data-icon="info" data-inline="true" data-i18n-target=".ui-btn-text" data-i18n="[title]gen.details_info;[html]gen.details"></a>
<div data-role="popup" id="provider_info_2" data-overlay-theme="a" data-theme="c" class="provider_popup ui-content ui-collapsible-popup">
<div data-role="header" data-theme="f" class="ui-header ui-body-f" role="banner">
<h1 class="ui-title t" role="heading" data-i18n="gen.details_info" aria-level="1"></h1>
</div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</div>
</td>
</tr>
<tr>
<th><a href="#" title=""><span class="image_wrapper"><img src="../img/providers/ggp.png"></span></a><h2 class="provider_name small">GoGRID Plus</h2></th>
<td><span class="key super key_loss">10<sup>-6</sup></span></td>
<td><span class="key super key_availability">99.22%</span></td>
<td><span class="key super key_cost">90€</span></td>
<td>
<a data-position-to="window" class="t scale-a" href="#provider_info_3" data-rel="popup" data-role="button" data-theme="c" data-icon="info" data-inline="true" data-i18n-target=".ui-btn-text" data-i18n="[title]gen.details_info;[html]gen.details"></a>
<div data-role="popup" id="provider_info_3" data-overlay-theme="a" data-theme="c" class="provider_popup ui-content ui-collapsible-popup">
<div data-role="header" data-theme="f" class="ui-header ui-body-f" role="banner">
<h1 class="ui-title t" role="heading" data-i18n="gen.details_info" aria-level="1"></h1>
</div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</div>
</td>
</tr>
<tbody class="rendered_result_wrapper">
<!-- placeholder -->
</tbody>
</table>
</div>
<!--[if lt IE 9]><script type="text/javascript" src="../js/plugins/jqplot/excanvas.js"></script><![endif]-->
<!--
<script language="javascript" type="text/javascript" src="../js/plugins/jqplot/jquery.jqplot.min.js"></script>
<script language="javascript" type="text/javascript" src="../js/plugins/jqplot/plugins/jqplot.categoryAxisRenderer.js"></script>
<script language="javascript" type="text/javascript" src="../js/plugins/jqplot/plugins/jqplot.barRenderer.min.js"></script>
-->
<script type="text/javascript">
<script type="text/javascript">
//<![CDATA[
var timer = null,
stored_regex = {
re_href: RegExp("tmp_href", "g"), // link to provider
re_title : RegExp("tmp_title", "g"), // text info for link to provider
re_img_path : RegExp("tmp_img_path", "g"), // path to logo of provider
re_name : RegExp("tmp_name", "g"), // name of provider
re_data_loss : RegExp("tmp_data_loss", "g"), // calculated data loss
re_percentile : RegExp("tmp_percentile", "g"),// calculated uptime
re_cost: RegExp("tmp_cost", "g"), // provider cost
re_count : RegExp("tmp_count", "g") // loop counter for popup
},
roundNumber = function (number) {
var digits = 2,
multiple = Math.pow(10, digits);
rndedNum = Math.round(number * multiple) / multiple;
return rndedNum;
},
getTemplate = function(block, context) {
var regex = RegExp('<!-- ' + block + '(.)+' + block + '(.)+?-->'),
tmpl = context.match(regex);
return tmpl.length ? tmpl[0].replace(/<!--[\s\S]*?-->/g, '') : '';
},
renderData = function (field, direction, search_term) {
var sort_by = field ? field : 'percentile',
sort_direction = direction ? direction : 'descending',
query_object = {
"query":{
"filter": {
"limit":[0,10],
"sort_on":[[sort_by,sort_direction]],
"select_list":[]
},
"wildcard_character":'%'
}
};
if (search_term) {
query_object.query.query = "percentile: = %"+search_term+"% OR downtime: %"+
search_term+"% OR totaltime: = %"+search_term+"% OR _id: = %"+
search_term+"%";
}
$.fn.util.spin('show');
// retrieve data
$.fn.fauna.jio_item_config.allDocs(
query_object,
function (err, response){
var jio_done = new Date().getMilliseconds();
if ($("#form_results_view").val() === "display_list") {
// table
var target = $(".rendered_result_wrapper");
// get html-template
require(['text!../tmp/tmp_results.html'], function (template_library) {
var use_template = 'tmp_result_row',
allRows = '', i, entry, display, instance;
t = getTemplate(use_template, template_library);
display = "table";
for (i = 0; i < response.length; i += 1) {
entry = response[i];
// clean up JIO here?
if (entry["ts"] < $.fn.fauna.items_good_until) {
$.fn.fauna.jio_item_config.delete({"_id":entry["id"]})
}
// create table-row
instance = t.replace('id="tmp_result_row"','')
.replace(stored_regex.re_name, entry["_id"])
.replace(stored_regex.re_percentile , roundNumber(entry["percentile"]))
.replace(stored_regex.re_count, i);
// bundle
allRows = allRows + instance
}
var rows_built = new Date().getMilliseconds();
// insert
target
.empty()
.append(allRows)
// enhance elements in the table rows
//.trigger("create") > breaks the table on 2nd run
.closest('table')
// refresh table
.filter(function() { return $(this).jqmData('bound') === true; })
.trigger('tablerefresh')
.end()
.closest('table')
// create table on first run
.filter(function() { return $(this).jqmData('bound') !== true; })
.jqmData('bound', true)
.attr('data-role', 'table')
.table({
create: function( event, ui ) {}
})
.table({
tablecreate: function( event, ui ) {}
});
var jqm_done = new Date().getMilliseconds();
$.fn.util.spin('hide');
});
} else {
// create graph object
}
});
};
// initialize
renderData();
$(document).ready(function() {
var gadget = RenderJs.getSelfGadget();
console.log(gadget);
// filter value storage (needed for timer)
gadget.filter_value = $('.ui-input-search input').val();
// interaction listener
gadget.translate = function(){
$.fn.util.lang(gadget.dom);
};
//$.jqplot('chartdiv', [[34.53, 56.32, 25.1, 18.6]], {series:[{renderer:$.jqplot.BarRenderer}]});
/* jqplot */
/* ADVANCED EXAMPLE
RocknCoder.Pages.manageBarChart = function () {
var pageshow = function () {
updateChart();
$("#refreshBarChart").click(function(){
updateChart();
});
},
pagehide = function () {
$("#refreshBarChart").unbind('click');
},
updateChart= function(){
var barA = parseInt($("#pageBarSliderA").val(),10),
barB = parseInt($("#pageBarSliderB").val(),10),
barC = parseInt($("#pageBarSliderC").val(),10);
showChart(barA, barB, barC);
},
showChart = function(barA, barB, barC){
$.jqplot('barChart', [[[barA,1], [barB,3], [barC,5]]], {
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
shadowAngle: 135,
rendererOptions: {
barDirection: 'horizontal'
},
pointLabels: {show: true, formatString: '%d'}
},
axes: {
yaxis: {
renderer: $.jqplot.CategoryAxisRenderer
}
}
}).replot({clear: true, resetAxes:true});
};
return {
pageshow: pageshow,
pagehide: pagehide
}
}();
*/
// trigger enhancement
// trigger JQM enhancement
$(this).trigger("render_enhance", {gadget: gadget.dom});
// sorting
$(document)
.find('#form_results_sort')
.filter(function() { return $(this).jqmData('bound') !== true; })
.jqmData('bound', true)
.on('change', function (e) {
var field, direction;
switch($(this).val()) {
case "sort_provider_az":
field = "_id";
direction = "descending";
break
case "sort_provider_za":
field = "_id";
direction = "ascending";
break
case "sort_price_highest":
field = "price";
direction = "descending";
break
case "sort_price_lowest":
field = "price";
direction = "ascending";
break
case "sort_score_highest":
field = "percentile";
direction = "descending";
break
case "sort_score_lowest":
field = "percentile";
direction = "ascending";
break
}
gadget.sort_field = field;
gadget.sort_direction = direction;
renderData(field, direction, null);
});
// searching (triggers after 1sec)
$(document).on('tablebeforefilter.results_filter', '#results_table', function ( e, data ) {
var inp = $( e.target ).parent().find('.ui-input-search input'),
val = inp.val();
// 1sec delay to allow entering multiple characters
if (timer) {
window.clearTimeout(timer);
}
if(val !== gadget.filter_value) {
timer = window.setTimeout(function(){
timer = null;
gadget.filter_value = val;
renderData(gadget.sort_field, gadget.sort_direction, val);
},1000);
}
})
// delete filter value
.on('click.results_filter', '.ui-input-clear', function () {
var val = "";
renderData(gadget.sort_field, gadget.sort_direction, val);
})
// unbind on hide (block with jqmData/class prevents multiple calls?
.off('pagehide','results_filter');
});
//]]>
</script>
......
<!DOCTYPE html>
<head>
<style type="text/css">
/* custom icons - languages */
.ui-icon-lang { background-image: url(../img/custom-lang-18.png); }
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-resolution: 240dpi) {
.ui-icon-lang {
-moz-background-size: 1200px 18px;
-o-background-size: 1200px 18px;
-webkit-background-size: 1200px 18px;
background-size: 1200px 18px;
}
.ui-icon-lang {
background-image: url(../img/custom-lang-36.png);
#background-image: url(../img/custom-lang-18.png);
}
}
/* background position for all sprites */
.ui-fake-icon.AT, .AT {background-position: 0px -50%;}
.ui-fake-icon.BE, .BE {background-position: -36px -50%;}
.ui-fake-icon.BG, .BG {background-position: -72px -50%;}
.ui-fake-icon.CH, .CH {background-position: -108px -50%;}
.ui-fake-icon.CZ, .CZ {background-position: -144px -50%;}
.ui-fake-icon.DE, .DE {background-position: -180px -50%;}
.ui-fake-icon.DK, .DK {background-position: -216px -50%;}
.ui-fake-icon.EE, .EE {background-position: -252px -50%;}
.ui-fake-icon.ES, .ES {background-position: -288px -50%;}
.ui-fake-icon.FI, .FI {background-position: -324px -50%;}
.ui-fake-icon.FR, .FR {background-position: -360px -50%;}
.ui-fake-icon.global, .global {background-position: -396px -50%;}
.ui-fake-icon.GR, .GR {background-position: -432px -50%;}
.ui-fake-icon.HU, .HU {background-position: -468px -50%;}
.ui-fake-icon.IE, .IE {background-position: -504px -50%;}
.ui-fake-icon.IS, .IS {background-position: -540px -50%;}
.ui-fake-icon.IT, .IT {background-position: -576px -50%;}
.ui-fake-icon.LT, .LT {background-position: -612px -50%;}
.ui-fake-icon.LV, .LV {background-position: -648px -50%;}
.ui-fake-icon.MT, .MT {background-position: -684px -50%;}
.ui-fake-icon.NL, .NL {background-position: -720px -50%;}
.ui-fake-icon.NO, .NO {background-position: -756px -50%;}
.ui-fake-icon.PL, .PL {background-position: -792px -50%;}
.ui-fake-icon.PT, .PT {background-position: -828px -50%;}
.ui-fake-icon.RO, .RO {background-position: -864px -50%;}
.ui-fake-icon.RU, .RU {background-position: -900px -50%;}
.ui-fake-icon.SCO, .SCO {background-position: -936px -50%;}
.ui-fake-icon.SE, .SE {background-position: -973px -50%;}
.ui-fake-icon.SK, .SK {background-position: -1008px -50%;}
.ui-fake-icon.UA, .UA {background-position: -1044px -50%;}
.ui-fake-icon.EN, .EN {background-position: -1080px -50%;}
.ui-fake-icon.WAL, .WAL {background-position:-1116px -50%;}
/* make some space */
.ui-li-text {padding-left: 40px; paddding-left: 15px; }
.ui-li-divider {text-align: center;}
</style>
</head>
<body>
<a data-role="button" class="setIcon" href="" data-rel="popup" data-position-to="origin" data-icon="lang" data-iconpos="notext">Languages</a>
<div data-role="popup" id="" class="all_popups">
<ul data-role="listview" data-inset="true" data-divider-theme="f">
<li data-role="list-divider" class="t" data-i18n="gen.language"></li>
<li data-icon="false"><a class="t change_language" href="?lang=FR-fr" data-i18n-target=".ui-li-text" data-i18n="[title]gen.language_info;[html]gen.lang.fr"><span class="ui-icon ui-fake-icon ui-li-icon ui-icon-lang ui-li-thumb FR">&nbsp;</span><span class="ui-li-text"></span></a></li>
<li data-icon="false"><a class="t change_language" href="?lang=DE-de" data-i18n-target=".ui-li-text" data-i18n="[title]gen.language_info;[html]gen.lang.de"><span class="ui-icon ui-fake-icon ui-li-icon ui-icon-lang ui-li-thumb DE">&nbsp;</span><span class="ui-li-text"></span></a></li>
<li data-icon="false"><a class="t change_language" href="?lang=EN-en" data-i18n-target=".ui-li-text" data-i18n="[title]gen.language_info;[html]gen.lang.en"><span class="ui-icon ui-fake-icon ui-li-icon ui-icon-lang ui-li-thumb EN">&nbsp;</span><span class="ui-li-text"></span></a></li>
</ul>
</div>
<script type="text/javascript" language="javascript">
//<![CDATA[
var gadget = RenderJs.getSelfGadget(),
recursive_gadgets = gadget.dom.find("[data-gadget]").not(".main-interactor"),
len = recursive_gadgets.length,
lang = $.fn.fauna.i18n_current_lang,
switchIcon = function () {
// this should be the callback after create, which sets the icon
// however setting elem here cannot access the JQM enhanced elements
// although the functions is called after JQM is done enhancing...
// var elem = gadget.dom.find(".setIcon .ui-icon");
// if (elem.length > 0) {
// elem.removeClass()
// .addClass('ui-icon ui-shadow ui-icon-lang '+set_icon);
// }
},
// set interactions
set_lang = function (language) {
var set_icon, elem;
switch (language) {
case "de-DE":
set_icon = "DE";
break;
case "fr-FR":
set_icon = "FR";
break;
default:
set_icon = "EN";
break;
};
$.fn.fauna.i18n_current_lang = language;
// modfiy elements, trigger translation
gadget.dom.trigger("translate");
if (gadget.isEnhanced() === false) {
$(document).trigger("render_enhance", {"gadget": gadget.dom, "callback":switchIcon()});
gadget.setEnhanced(true);
}
// NONO!
setTimeout(function () {
elem = gadget.dom.find(".setIcon .ui-icon");
if (elem.length > 0) {
elem.removeClass()
.addClass('ui-icon ui-shadow ui-icon-lang '+set_icon);
}
},50);
};
// modify gadget
if (gadget.self !== undefined) {
for (key in gadget.self) {
if (gadget.self.hasOwnProperty(key)) {
gadget.dom.find(key).attr(gadget.self[key][0],gadget.self[key][1]);
}
}
}
recursive_gadgets.each(function (i) {
var passJSON = gadget[$(this).attr('id')],
string, new_string,
current_id = $(this).attr('id'),
new_id = current_id+"__"+gadget.dom.attr('id');
// pass on JSON if present BEFORE modifying gadget-id
if (passJSON !== undefined) {
$(this).attr('data-gadget-property','{"self":'+JSON.stringify(passJSON)+'}');
}
// dynamic gadget-id
$(this).attr('id', new_id);
// update interactions
string = gadget.dom.find(".main-interactor").attr("data-gadget-connection");
new_string = string.replace(current_id,new_id);
gadget.dom.find(".main-interactor").attr("data-gadget-connection",new_string);
});
// initializing setter
$(document).on('i18n_ready', function (e, data) {
set_lang(data.lang);
});
$(document).ready(function() {
// regular page setter
if (lang !== undefined) {
set_lang($.fn.fauna.i18n_current_lang);
}
// switch language
$(this)
.filter(function() { return $(this).jqmData("i18n") !== true; })
.jqmData('i18n',true)
.on('click', '.change_language', function(e) {
var lang = $(this).attr('href').replace('?lang=','');
e.preventDefault();
$('.all_popups').popup( "close" );
// switch to new language
$.i18n.setLng(lang, function() {
// translate everything in gadget
$.fn.util.lang(gadget.dom);
// interaction! switch icon (triggers translate on all other gadgets
set_lang($.i18n.lng());
});
});
});
//]]>
</script>
</body>
</html>
\ No newline at end of file
......@@ -6,14 +6,25 @@ define([], function () {
"use strict";
var start = function () {
require(['i18next', 'jquery', 'jqm', 'overrides', 'text', 'renderjs', 'jio'],
require(['i18next', 'jio', 'jquery', 'jqm', 'overrides', 'text', 'renderjs'],
function (i18n) {
var fauna = {}, // application environment (PUBLIC-settings)
flora = {}, // user environment (PRIVATE-settings)
flora = {
items_good_until: new Date("March 20, 2013 00:00:00")
}, // user environment (PRIVATE)
util = {} // utility functions (PUBLIC)
util = {
// spinner
spin : function (what){
if ( what == "show"){
$.mobile.showPageLoadingMsg();
} else {
$.mobile.hidePageLoadingMsg()
}
},
// screen size small/medium/large
framer: function () {
var self = this, framed;
......@@ -27,6 +38,48 @@ define([], function () {
return framed;
},
// ajax content
ajaxContent : function (ajaxObject) {
var target = ajaxObject.target;
$.ajax({
async: true,
type: 'GET',
returnFormat: 'json',
data: {
value: ajaxObject.param1,
type: ajaxObject.param2
},
url: ajaxObject.url,
timeout: 25000,
success: function(data, target) {
ajaxObject.successHandler(data, ajaxObject.target)
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
ajaxObject.errorHandler(XMLHttpRequest, textStatus, errorThrown);
$.mobile.loading('hide');
}
});
},
// ajax forms
ajaxFormSubmit : function (ajaxObject) {
var target = ajaxObject.target;
$.ajax({
headers: { "cache-control": "no-cache" },
async: false,
type: ajaxObject.type == "" ? "get" : ajaxObject.type,
url: ajaxObject.url,
data: ajaxObject.formdata,
dataType: ajaxObject.returnformat,
success: function(data){
ajaxObject.handleDataInResponse === "true" ? ajaxObject.successHandler(data) : successHandler();
},
error: function (jqXHR, XMLHttpRequest, textStatus, errorThrown) {
//
}
});
},
// resize buttons labelled with scale-a/div/input
scale: function () {
if(util.framer() === "small") {
......@@ -87,7 +140,10 @@ define([], function () {
}
}
};
// ===========================================================
// global page handling
$(document).on('pagecreate', 'div:jqmData(role="page")', function() {
......@@ -96,7 +152,33 @@ define([], function () {
"text!../gadgets/pagefooter.html"
],
target = [$('head'),$('body')],
page = $(this);
page = $(this),
ajaxObject = {}
// initialize jio_config
if (fauna.jio_base_config === undefined) {
// initialize jio
fauna.jio_config = jIO.newJio({
"type": "local",
"username": "app_config",
"application_name": "cloudquote"
});
// request base configuration
ajaxObject = {
url: "../data/app_config.json",
target: "",
param1: null,
param2: null,
successHandler : function (data, target) {
},
errorHandler : function (XMLHttpRequest, textStatus, errorThrown) {
}
};
util.ajaxContent(ajaxObject);
}
// <head>/page footer on first page
if (fauna.anchor_page === undefined) {
......@@ -144,16 +226,14 @@ define([], function () {
// enhancing gadgets when everyone else is done
$(document).on('render_enhance', function(e, data) {
console.log("render_enhance registered");
console.log("trying to call trigger create");
data.gadget.trigger("create");
// if (data.callback !== undefined) {
// data.callback();
// }
});
// ===========================================================
// ===========================================================
// init application
if ($.mobile.autoInitializePage === false){
$.mobile.initializePage();
......
/*
* Copyright 2013, Nexedi SA
* Released under the LGPL license.
* http://www.gnu.org/licenses/lgpl.html
*/
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */
/*global jIO: true, $: true, btoa: true */
jIO.addStorageType('dav', function (spec, my) {
spec = spec || {};
var that, priv, super_serialized;
that = my.basicStorage(spec, my);
priv = {};
super_serialized = that.serialized;
priv.secureDocId = function (string) {
var split = string.split('/'),
i;
if (split[0] === '') {
split = split.slice(1);
}
for (i = 0; i < split.length; i += 1) {
if (split[i] === '') {
return '';
}
}
return split.join('%2F');
};
priv.convertSlashes = function (string) {
return string.split('/').join('%2F');
};
priv.restoreSlashes = function (string) {
return string.split('%2F').join('/');
};
/**
* Checks if an object has no enumerable keys
* @method objectIsEmpty
* @param {object} obj The object
* @return {boolean} true if empty, else false
*/
priv.objectIsEmpty = function (obj) {
var k;
for (k in obj) {
if (obj.hasOwnProperty(k)) {
return false;
}
}
return true;
};
priv.username = spec.username || '';
priv.secured_username = priv.convertSlashes(priv.username);
priv.password = spec.password || '';
priv.url = spec.url || '';
that.serialized = function () {
var o = super_serialized();
o.username = priv.username;
o.url = priv.url;
o.password = priv.password;
return o;
};
priv.newAsyncModule = function () {
var async = {};
async.call = function (obj, function_name, arglist) {
obj._wait = obj._wait || {};
if (obj._wait[function_name]) {
obj._wait[function_name] -= 1;
return function () {};
}
// ok if undef or 0
arglist = arglist || [];
return obj[function_name].apply(obj[function_name], arglist);
};
async.neverCall = function (obj, function_name) {
obj._wait = obj._wait || {};
obj._wait[function_name] = -1;
};
async.wait = function (obj, function_name, times) {
obj._wait = obj._wait || {};
obj._wait[function_name] = times;
};
async.end = function () {
async.call = function () {};
};
return async;
};
/**
* Checks if a browser supports cors (cross domain ajax requests)
* @method checkCors
* @return {boolean} true if supported, else false
*/
priv.checkCors = function () {
return $.support.cors;
};
/**
* Replaces last "." with "_." in document filenames
* @method underscoreFileExtenisons
* @param {string} url url to clean up
* @return {string} clean_url cleaned up URL
*/
priv.underscoreFileExtenisons = function (url) {
var clean_url = url.replace(/,\s(\w+)$/, "_.$1");
return clean_url;
};
/**
* Replaces "_." with "." in document filenames
* @method restoreDots
* @param {string} url url to clean up
* @return {string} clean_url cleaned up URL
*/
priv.restoreDots = function (url) {
var clean_url = url.replace(/_\./g, '.');
return clean_url;
};
/**
* Runs all ajax requests for davStorage
* @method ajax
* @param {object} ajax_object The request parameters
*/
priv.ajax = function (ajax_object) {
$.ajax({
url: ajax_object.url,
type: ajax_object.type,
async: true,
dataType: ajax_object.dataType || null,
data: ajax_object.data || null,
crossdomain : true,
headers : {
Authorization: 'Basic ' + btoa(
priv.username + ':' + priv.password
),
Depth: ajax_object.headers === undefined ? null :
ajax_object.headers.depth
},
// xhrFields: {withCredentials: 'true'},
success: ajax_object.success,
error: ajax_object.error
});
};
/**
* Creates error objects for this storage
* @method createError
* @param {string} url url to clean up
* @return {object} error The error object
*/
priv.createError = function (status, message, reason) {
var error = {};
switch (status) {
case 404:
error.status = status;
error.statusText = "Not found";
error.error = "not_found";
error.message = message;
error.reason = reason;
break;
case 405:
error.status = status;
error.statusText = "Method Not Allowed";
error.error = "method_not_allowed";
error.message = message;
error.reason = reason;
break;
case 409:
error.status = status;
error.statusText = "Conflicts";
error.error = "conflicts";
error.message = message;
error.reason = reason;
break;
}
return error;
};
/**
* Check if method can be run on browser
* @method support
*/
priv.support = function (docid) {
// no docId
if (!(typeof docid === "string" && docid !== "")) {
that.error(priv.createError(405, "Can't create document without id",
"Document id is undefined"
));
return true;
}
// no cross domain ajax
if (priv.checkCors === false) {
that.error(priv.createError(405,
"Browser does not support cross domain ajax", "CORS is undefined"
));
return true;
}
};
// wedDav methods rfc4918 (short summary)
// COPY Reproduces single resources (files) and collections (directory
// trees). Will overwrite files (if specified by request) but will
// respond 209 (Conflict) if it would overwrite a tree
// DELETE deletes files and directory trees
// GET just the vanilla HTTP/1.1 behaviour
// HEAD ditto
// LOCK locks a resources
// MKCOL creates a directory
// MOVE Moves (rename or copy) a file or a directory tree. Will
// 'overwrite' files (if specified by the request) but will respond
// 209 (Conflict) if it would overwrite a tree.
// OPTIONS If WebDAV is enabled and available for the path this reports the
// WebDAV extension methods
// PROPFIND Retrieves the requested file characteristics, DAV lock status
// and 'dead' properties for individual files, a directory and its
// child files, or a directory tree
// PROPPATCHset and remove 'dead' meta-data properties
// PUT Update or create resource or collections
// UNLOCK unlocks a resource
// Notes: all Ajax requests should be CORS (cross-domain)
// adding custom headers triggers preflight OPTIONS request!
// http://remysharp.com/2011/04/21/getting-cors-working/
priv.putOrPost = function (command, type) {
var docid = command.getDocId(), secured_docid, url, ajax_object;
if (priv.support(docid)) {
return;
}
secured_docid = priv.secureDocId(command.getDocId());
url = priv.url + '/' + priv.underscoreFileExtenisons(secured_docid);
ajax_object = {
url: url + '?_=' + Date.now(),
type: "GET",
dataType: "text",
success: function () {
if (type === 'POST') {
// POST the document already exists
that.error(priv.createError(409,
"Cannot create a new document", "Document already exists"
));
return;
}
ajax_object = {
url: url,
type: type,
data: JSON.stringify(command.getDoc()),
success: function () {
that.success({
ok: true,
id: command.getDocId()
});
},
error: function () {
that.error(priv.createError(409, "Cannot modify document",
"Error writing to remote storage"
));
}
};
priv.ajax(ajax_object);
},
error: function (err) {
// Firefox returns 0 instead of 404 on CORS?
if (err.status === 404 || err.status === 0) {
ajax_object = {
url: url,
type: "PUT",
data: JSON.stringify(command.getDoc()),
success: function () {
that.success({
ok: true,
id: command.getDocId()
});
},
error: function () {
that.error(priv.createError(409,
"Cannot modify document", "Error writing to remote storage"
));
}
};
priv.ajax(ajax_object);
} else {
// error accessing remote storage
that.error({
"status": err.status,
"statusText": err.statusText,
"error": "error",
"message": err.message,
"reason": "Failed to access remote storage"
});
}
}
};
priv.ajax(ajax_object);
};
/**
* Creates a new document
* @method post
* @param {object} command The JIO command
*/
that.post = function (command) {
priv.putOrPost(command, 'POST');
};
/**
* Creates or updates a document
* @method put
* @param {object} command The JIO command
*/
that.put = function (command) {
priv.putOrPost(command, 'PUT');
};
/**
* Add an attachment to a document
* @method putAttachment
* @param {object} command The JIO command
*/
that.putAttachment = function (command) {
var docid = command.getDocId(),
doc,
url,
secured_docid,
secured_attachmentid,
attachment_url,
ajax_object;
priv.support(docid);
secured_docid = priv.secureDocId(docid);
url = priv.url + '/' + priv.underscoreFileExtenisons(secured_docid);
ajax_object = {
url: url + '?_=' + Date.now(),
type: 'GET',
dataType: 'text',
success: function (response) {
doc = JSON.parse(response);
// the document exists - update document
doc._attachments = doc._attachments || {};
doc._attachments[command.getAttachmentId()] = {
"content_type": command.getAttachmentMimeType(),
"digest": "md5-" + command.md5SumAttachmentData(),
"length": command.getAttachmentLength()
};
// put updated document data
ajax_object = {
url: url + '?_=' + Date.now(),
type: 'PUT',
data: JSON.stringify(doc),
success: function () {
secured_attachmentid = priv.secureDocId(command.getAttachmentId());
attachment_url = url + '.' +
priv.underscoreFileExtenisons(secured_attachmentid);
ajax_object = {
url: attachment_url + '?_=' + Date.now(),
type: 'PUT',
data: JSON.stringify(command.getDoc()),
success: function () {
that.success({
ok: true,
id: command.getDocId() + '/' + command.getAttachmentId()
});
},
error: function () {
that.error(priv.createError(409,
"Cannot modify document", "Error when saving attachment"
));
return;
}
};
priv.ajax(ajax_object);
},
error: function () {
that.error(priv.createError(409,
"Cannot modify document", "Error writing to remote storage"
));
return;
}
};
priv.ajax(ajax_object);
},
error: function () {
// the document does not exist
that.error(priv.createError(404,
"Impossible to add attachment", "Document not found"
));
return;
}
};
// see if the underlying document exists
priv.ajax(ajax_object);
};
/**
* Get a document or attachment from distant storage
* Options:
* - {boolean} revs Add simple revision history (false by default).
* - {boolean} revs_info Add revs info (false by default).
* - {boolean} conflicts Add conflict object (false by default).
* @method get
* @param {object} command The JIO command
*/
that.get = function (command) {
var docid = command.getDocId(),
doc,
url,
secured_docid,
secured_attachmentid,
attachment_url,
ajax_object;
if (priv.support(docid)) {
return;
}
secured_docid = priv.secureDocId(command.getDocId());
url = priv.url + '/' + priv.underscoreFileExtenisons(secured_docid);
if (typeof command.getAttachmentId() === "string") {
secured_attachmentid = priv.secureDocId(command.getAttachmentId());
attachment_url = url + '.' + priv.underscoreFileExtenisons(
secured_attachmentid
);
// get attachment
ajax_object = {
url: attachment_url + '?_=' + Date.now(),
type: "GET",
dataType: "text",
success: function (response) {
doc = JSON.parse(response);
that.success(doc);
},
error: function () {
that.error(priv.createError(404,
"Cannot find the attachment", "Attachment does not exist"
));
}
};
priv.ajax(ajax_object);
} else {
// get document
ajax_object = {
url: url + '?_=' + Date.now(),
type: "GET",
dataType: "text",
success: function (response) {
// metadata_only should not be handled by jIO, as it is a
// webDav only option, shouldn't it?
// ditto for content_only
doc = JSON.parse(response);
that.success(doc);
},
error: function () {
that.error(priv.createError(404,
"Cannot find the document", "Document does not exist"
));
}
};
priv.ajax(ajax_object);
}
};
/**
* Remove a document or attachment
* @method remove
* @param {object} command The JIO command
*/
that.remove = function (command) {
var docid = command.getDocId(), doc, url,
secured_docid, secured_attachmentid, attachment_url,
attachment_list = [], i, j, k = 1, deleteAttachment, ajax_object;
if (priv.support(docid)) {
return;
}
secured_docid = priv.secureDocId(command.getDocId());
url = priv.url + '/' + priv.underscoreFileExtenisons(secured_docid);
// remove attachment
if (typeof command.getAttachmentId() === "string") {
secured_attachmentid = priv.secureDocId(command.getAttachmentId());
attachment_url = url + '.' + priv.underscoreFileExtenisons(
secured_attachmentid
);
ajax_object = {
url: attachment_url + '?_=' + Date.now(),
type: "DELETE",
success: function () {
// retrieve underlying document
ajax_object = {
url: url + '?_=' + Date.now(),
type: "GET",
dataType: "text",
success: function (response) {
// underlying document
doc = JSON.parse(response);
// update doc._attachments
if (typeof doc._attachments === "object") {
if (typeof doc._attachments[command.getAttachmentId()] ===
"object") {
delete doc._attachments[command.getAttachmentId()];
if (priv.objectIsEmpty(doc._attachments)) {
delete doc._attachments;
}
// PUT back to server
ajax_object = {
url: url + '?_=' + Date.now(),
type: 'PUT',
data: JSON.stringify(doc),
success: function () {
that.success({
"ok": true,
"id": command.getDocId() + '/' +
command.getAttachmentId()
});
},
error: function () {
that.error(priv.createError(409,
"Cannot modify document", "Error saving attachment"
));
}
};
priv.ajax(ajax_object);
} else {
// sure this if-else is needed?
that.error(priv.createError(404,
"Cannot find document", "Error updating attachment"
));
}
} else {
// no attachments, we are done
that.success({
"ok": true,
"id": command.getDocId() + '/' + command.getAttachmentId()
});
}
},
error: function () {
that.error(priv.createError(404,
"Cannot find the document", "Document does not exist"
));
}
};
priv.ajax(ajax_object);
},
error: function () {
that.error(priv.createError(404,
"Cannot find the attachment", "Error removing attachment"
));
}
};
priv.ajax(ajax_object);
// remove document incl. all attachments
} else {
ajax_object = {
url: url + '?_=' + Date.now(),
type: 'GET',
dataType: 'text',
success: function (response) {
var x;
doc = JSON.parse(response);
// prepare attachment loop
if (typeof doc._attachments === "object") {
// prepare list of attachments
for (x in doc._attachments) {
if (doc._attachments.hasOwnProperty(x)) {
attachment_list.push(x);
}
}
}
// delete document
ajax_object = {
url: url + '?_=' + Date.now(),
type: 'DELETE',
success: function () {
j = attachment_list.length;
// no attachments, done
if (j === 0) {
that.success({
"ok": true,
"id": command.getDocId()
});
} else {
deleteAttachment = function (attachment_url, j, k) {
ajax_object = {
url: attachment_url + '?_=' + Date.now(),
type: 'DELETE',
success: function () {
// all deleted, return response, need k as async couter
if (j === k) {
that.success({
"ok": true,
"id": command.getDocId()
});
} else {
k += 1;
}
},
error: function () {
that.error(priv.createError(404,
"Cannot find attachment", "Error removing attachment"
));
}
};
priv.ajax(ajax_object);
};
for (i = 0; i < j; i += 1) {
secured_attachmentid = priv.secureDocId(attachment_list[i]);
attachment_url = url + '.' + priv.underscoreFileExtenisons(
secured_attachmentid
);
deleteAttachment(attachment_url, j, k);
}
}
},
error: function () {
that.error(priv.createError(404,
"Cannot find the document", "Error removing document"
));
}
};
priv.ajax(ajax_object);
},
error: function () {
that.error(priv.createError(404,
"Cannot find the document", "Document does not exist"
));
}
};
priv.ajax(ajax_object);
}
};
/**
* Gets a document list from a distant dav storage
* Options:
* - {boolean} include_docs Also retrieve the actual document content.
* @method allDocs
* @param {object} command The JIO command
*/
//{
// "total_rows": 4,
// "rows": [
// {
// "id": "otherdoc",
// "key": "otherdoc",
// "value": {
// "rev": "1-3753476B70A49EA4D8C9039E7B04254C"
// }
// },{...}
// ]
//}
that.allDocs = function (command) {
var rows = [], url,
am = priv.newAsyncModule(),
o = {},
ajax_object;
o.getContent = function (file) {
var docid = priv.secureDocId(file.id),
url = priv.url + '/' + docid;
ajax_object = {
url: url + '?_=' + Date.now(),
type: 'GET',
dataType: 'text',
success: function (content) {
file.doc = JSON.parse(content);
rows.push(file);
am.call(o, 'success');
},
error: function (type) {
that.error(priv.createError(404,
"Cannot find the document", "Can't get document from storage"
));
am.call(o, 'error', [type]);
}
};
priv.ajax(ajax_object);
};
o.getDocumentList = function () {
url = priv.url + '/';
ajax_object = {
url: url + '?_=' + Date.now(),
type: "PROPFIND",
dataType: "xml",
headers : { depth: '1' },
success: function (xml) {
var response = $(xml).find('D\\:response, response'),
len = response.length;
if (len === 1) {
return am.call(o, 'success');
}
am.wait(o, 'success', len - 2);
response.each(function (i, data) {
if (i > 0) { // exclude parent folder
var file = {
value: {}
};
$(data).find('D\\:href, href').each(function () {
var split = $(this).text().split('/');
file.id = split[split.length - 1];
file.id = priv.restoreSlashes(file.id);
file.key = file.id;
});
if (command.getOption('include_docs')) {
am.call(o, 'getContent', [file]);
} else {
rows.push(file);
am.call(o, 'success');
}
}
});
},
error: function (type) {
that.error(priv.createError(404,
"Cannot find the document", "Can't get document list"
));
am.call(o, 'retry', [type]);
}
};
priv.ajax(ajax_object);
};
o.retry = function (error) {
am.neverCall(o, 'retry');
am.neverCall(o, 'success');
am.neverCall(o, 'error');
that.retry(error);
};
o.error = function (error) {
am.neverCall(o, 'retry');
am.neverCall(o, 'success');
am.neverCall(o, 'error');
that.error(error);
};
o.success = function () {
am.neverCall(o, 'retry');
am.neverCall(o, 'success');
am.neverCall(o, 'error');
that.success({
total_rows: rows.length,
rows: rows
});
};
// first get the XML list
am.call(o, 'getDocumentList');
};
return that;
});
\ No newline at end of file
/*global window, define */
// Adds 5 dummy storages to JIO
// type:
// - dummyallok
// - dummyallfail
// - dummyallnotfound
// - dummyall3tries
// - dummyalldocs
// - dummyallfound
(function () {
'use strict';
var jioDummyStorageLoader = function (jIO) {
/////////////////////////////////////////////////////////////////
// Dummy Storage 1 : all ok
var newDummyStorageAllOk = function (spec, my) {
var that = my.basicStorage(spec, my);
that.specToStore = function () {
return {
"username": spec.username
};
};
that.post = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId()
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end post
that.put = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId()
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end put
that.putAttachment = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end putAttachment
that.get = function (command) {
window.setTimeout(function () {
if (command.getAttachmentId()) {
return that.success('0123456789');
}
that.success({
"_id": command.getDocId(),
"title": 'get_title'
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end get
that.allDocs = function (command) {
window.setTimeout(function () {
that.error({
"status": 405,
"statusText": "Method Not Allowed",
"error": "method_not_allowed",
"message": "Your are not allowed to use" +
"this command",
"reason": "LocalStorage forbids AllDocs" +
"command executions"
});
});
}; // end allDocs
that.remove = function (command) {
window.setTimeout(function () {
if (command.getAttachmentId()) {
that.success({
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
} else {
that.success({
"ok": true,
"id": command.getDocId()
});
}
}, 100); // 100 ms, for jiotests simple job waiting
}; // end remove
return that;
},
// end Dummy Storage All Ok
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 2 : all fail
newDummyStorageAllFail = function (spec, my) {
var that = my.basicStorage(spec, my),
priv = {};
priv.error = function () {
window.setTimeout(function () {
that.error({
status: 0,
statusText: 'Unknown Error',
error: 'unknown_error',
message: 'Execution encountred an error.',
reason: 'Execution encountred an error'
});
}, 100);
};
that.post = function (command) {
priv.error();
}; // end post
that.put = function (command) {
priv.error();
}; // end put
that.putAttachment = function (command) {
priv.error();
}; // end put
that.get = function (command) {
priv.error();
}; // end get
that.allDocs = function (command) {
window.setTimeout(function () {
that.error({
"status": 405,
"statusText": "Method Not Allowed",
"error": "method_not_allowed",
"message": "Your are not allowed to use" +
"this command",
"reason": "LocalStorage forbids AllDocs" +
"command executions"
});
});
}; // end allDocs
that.remove = function (command) {
priv.error();
}; // end remove
return that;
},
// end Dummy Storage All Fail
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 3 : all not found
newDummyStorageAllNotFound = function (spec, my) {
var that = my.basicStorage(spec, my);
that.post = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId()
});
}, 100);
}; // end post
that.put = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId()
});
}, 100);
}; // end put
that.putAttachment = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
}, 100);
}; // end put
that.get = function (command) {
window.setTimeout(function () {
that.error({
"status": 404,
"statusText": "Not Found",
"error": "not_found",
"message": "Document '" + command.getDocId() +
"' not found",
"reason": "Document '" + command.getDocId() +
"'does not exist"
});
}, 100);
}; // end get
that.allDocs = function (command) {
window.setTimeout(function () {
that.error({
"status": 405,
"statusText": "Method Not Allowed",
"error": "method_not_allowed",
"message": "Your are not allowed to use" +
"this command",
"reason": "LocalStorage forbids AllDocs" +
"command executions"
});
});
}; // end allDocs
that.remove = function (command) {
window.setTimeout(function () {
that.error({
"status": 404,
"statusText": "Not Found",
"error": "not_found",
"message": "Cannot remove an unexistant" +
"document",
"reason": "missing" // or deleted
});
}, 100);
}; // end remove
return that;
},
// end Dummy Storage All Not Found
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 4 : all 3 tries
newDummyStorageAll3Tries = function (spec, my) {
var that = my.basicStorage(spec, my),
priv = {};
// this specToStore method is used to make simple
// difference between two dummyall3tries storages:
// so {type:'dummyall3tries',a:'b'} differs from
// {type:'dummyall3tries',c:'d'}.
that.specToStore = function () {
return {
"application_name": spec.application_name
};
};
priv.doJob = function (command, if_ok_return) {
// wait a little to simulate asynchronous operation
window.setTimeout(function () {
priv.Try3OKElseFail(command.getTried(),
if_ok_return);
}, 100);
};
priv.Try3OKElseFail = function (tries, if_ok_return) {
if (tries === 'undefined') {
return that.error({
"status": 0,
"statusText": "Unknown Error",
"error": "unknown_error",
"message": "Cannot get tried",
"reason": "Unknown"
});
}
if (tries < 3) {
return that.retry({
message: 'Now' + (3 - tries) + ' tries left.'
});
}
if (tries === 3) {
return that.success(if_ok_return);
}
if (tries > 3) {
return that.error({
"status": 1,
"statusText": "Too Much Tries",
"error": "too_much_tries",
"message": "Too much tries",
"reason": "Too much tries"
});
}
};
that.post = function (command) {
priv.doJob(command, {
"ok": true,
"id": command.getDocId()
});
}; // end post
that.put = function (command) {
priv.doJob(command, {
"ok": true,
"id": command.getDocId()
});
}; // end put
that.putAttachment = function (command) {
priv.doJob(command, {
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
}; // end put
that.get = function (command) {
if (command.getAttachmentId()) {
priv.doJob(command, "0123456789");
} else {
priv.doJob(command, {
"_id": command.getDocId(),
"title": 'Title of ' + command.getDocId()
});
}
}; // end get
that.allDocs = function (command) {
window.setTimeout(function () {
that.error({
"status": 405,
"statusText": "Method Not Allowed",
"error": "method_not_allowed",
"message": "Your are not allowed to use" +
"this command",
"reason": "LocalStorage forbids AllDocs" +
"command executions"
});
});
}; // end allDocs
that.remove = function (command) {
if (command.getAttachmentId()) {
priv.doJob(command, {
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
} else {
priv.doJob(command, {
"ok": true,
"id": command.getDocId()
});
}
}; // end remove
return that;
},
// end Dummy Storage All 3 Tries
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 5 : all docs
newDummyStorageAllDocs = function (spec, my) {
var that = my.basicStorage(spec, my);
that.specToStore = function () {
return {
"username": spec.username
};
};
that.post = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId()
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end post
that.put = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId()
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end put
that.putAttachment = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end putAttachment
that.get = function (command) {
window.setTimeout(function () {
if (command.getAttachmentId()) {
return that.success('0123456789');
}
that.success({
"_id": command.getDocId(),
"title": "get_title"
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end get
that.allDocs = function (command) {
window.setTimeout(function () {
var addRow,
o = {
"total_rows": 0,
"rows": []
};
addRow = function (id, key, doc) {
var row = {
"id": "file",
"key": "file",
"value": {}
};
if (command.getOption("include_docs")) {
row.doc = doc;
}
o.rows.push(row);
o.total_rows += 1;
};
addRow("file", "file", {
"_id": "file",
"Title": "myFile"
});
addRow("mylongtitledfilethatidontliketowriteby" +
"handonablackboard", "mylongtialias1", {
"_id": "mylongtitledfilethatidontlike" +
"towritebyhandonablackboard",
"Title": "myLongFile"
});
that.success(o);
});
}; // end allDocs
that.remove = function (command) {
window.setTimeout(function () {
if (command.getAttachmentId()) {
that.success({
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
} else {
that.success({
"ok": true,
"id": command.getDocId()
});
}
}, 100); // 100 ms, for jiotests simple job waiting
}; // end remove
return that;
},
// end Dummy Storage All Docs
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 6 : all found
newDummyStorageAllFound = function (spec, my) {
var that = my.basicStorage(spec, my);
that.post = function (command) {
window.setTimeout(function () {
that.error({
"status": 409,
"statusText": "Conflicts",
"error": "conflicts",
"message": "Cannot create a new document",
"reason": "Document already exists"
});
}, 100);
}; // end post
that.put = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId()
});
}, 100);
}; // end put
that.putAttachment = function (command) {
window.setTimeout(function () {
that.success({
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
}, 100);
}; // end put
that.get = function (command) {
window.setTimeout(function () {
if (command.getAttachmentId()) {
return that.success('0123456789');
}
that.success({
"_id": command.getDocId(),
"title": 'get_title'
});
}, 100); // 100 ms, for jiotests simple job waiting
}; // end get
that.allDocs = function (command) {
window.setTimeout(function () {
that.error({
"status": 405,
"statusText": "Method Not Allowed",
"error": "method_not_allowed",
"message": "Your are not allowed to use" +
"this command",
"reason": "LocalStorage forbids AllDocs" +
"command executions"
});
});
}; // end allDocs
that.remove = function (command) {
window.setTimeout(function () {
if (command.getAttachmentId()) {
that.success({
"ok": true,
"id": command.getDocId() + "/" +
command.getAttachmentId()
});
} else {
that.success({
"ok": true,
"id": command.getDocId()
});
}
}, 100); // 100 ms, for jiotests simple job waiting
}; // end remove
return that;
};
// end Dummy Storage All Not Found
/////////////////////////////////////////////////////////////////
// add key to storageObjectType of global jio
jIO.addStorageType('dummyallok', newDummyStorageAllOk);
jIO.addStorageType('dummyallfail', newDummyStorageAllFail);
jIO.addStorageType('dummyallnotfound',
newDummyStorageAllNotFound);
jIO.addStorageType('dummyall3tries', newDummyStorageAll3Tries);
jIO.addStorageType('dummyalldocs', newDummyStorageAllDocs);
jIO.addStorageType('dummyallfound', newDummyStorageAllFound);
};
if (window.requirejs) {
define('JIODummyStorages', ['jIO'], jioDummyStorageLoader);
} else {
jioDummyStorageLoader(jIO);
}
}());
\ No newline at end of file
......@@ -268,6 +268,18 @@ var storage = function (spec, my) {
});
};
that.check = function (command) {
setTimeout(function () {
that.success({"ok": true, "id": command.getDocId()});
});
};
that.repair = function (command) {
setTimeout(function () {
that.success({"ok": true, "id": command.getDocId()});
});
};
that.success = function () {};
that.retry = function () {};
that.error = function () {};
......@@ -284,16 +296,10 @@ var storage = function (spec, my) {
that.addJob = function (method, storage_spec, doc, option, success, error) {
var command_opt = {
doc: doc,
options: option,
callbacks: {success: success, error: error}
};
if (doc) {
if (method === 'get') {
command_opt.docid = doc;
} else {
command_opt.doc = doc;
}
}
jobManager.addJob(job({
storage: priv.storage(storage_spec || {}),
command: priv.newCommand(method, command_opt)
......@@ -329,10 +335,49 @@ var allDocsCommand = function (spec, my) {
return that;
};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global command: true */
var checkCommand = function (spec, my) {
var that = command(spec, my);
spec = spec || {};
my = my || {};
// Methods //
that.getLabel = function () {
return 'check';
};
that.validateState = function () {
if (!(typeof that.getDocId() === "string" && that.getDocId() !==
"")) {
that.error({
"status": 20,
"statusText": "Document Id Required",
"error": "document_id_required",
"message": "The document id is not provided",
"reason": "Document id is undefined"
});
return false;
}
return true;
};
that.executeOn = function (storage) {
storage.check(that);
};
that.canBeRestored = function () {
return false;
};
return that;
};
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */
/*global postCommand: true, putCommand: true, getCommand: true,
removeCommand: true, allDocsCommand: true,
getAttachmentCommand: true, removeAttachmentCommand: true,
putAttachmentCommand: true, failStatus: true, doneStatus: true,
checkCommand: true, repairCommand: true,
hex_md5: true */
var command = function (spec, my) {
var that = {},
......@@ -347,7 +392,11 @@ var command = function (spec, my) {
'get': getCommand,
'remove': removeCommand,
'allDocs': allDocsCommand,
'putAttachment': putAttachmentCommand
'getAttachment': getAttachmentCommand,
'putAttachment': putAttachmentCommand,
'removeAttachment': removeAttachmentCommand,
'check': checkCommand,
'repair': repairCommand
};
// creates the good command thanks to his label
if (spec.label && priv.commandlist[spec.label]) {
......@@ -363,11 +412,10 @@ var command = function (spec, my) {
"_id": priv.doc.toString()
};
}
priv.docid = spec.docid || priv.doc._id;
priv.option = spec.options || {};
priv.callbacks = spec.callbacks || {};
priv.success = priv.callbacks.success || function () {};
priv.error = priv.callbacks.error || function () {};
priv.success = [priv.callbacks.success || function () {}];
priv.error = [priv.callbacks.error || function () {}];
priv.retry = function () {
that.error({
status: 13,
......@@ -410,10 +458,7 @@ var command = function (spec, my) {
* @return {string} The document id
*/
that.getDocId = function () {
if (typeof priv.docid !== "string") {
return undefined;
}
return priv.docid.split('/')[0];
return priv.doc._id;
};
/**
......@@ -422,19 +467,7 @@ var command = function (spec, my) {
* @return {string} The attachment id
*/
that.getAttachmentId = function () {
if (typeof priv.docid !== "string") {
return undefined;
}
return priv.docid.split('/')[1];
};
/**
* Returns the label of the command.
* @method getDoc
* @return {object} The document.
*/
that.getDoc = function () {
return priv.doc;
return priv.doc._attachment;
};
/**
......@@ -498,8 +531,8 @@ var command = function (spec, my) {
* @param {object} storage The storage.
*/
that.validate = function (storage) {
if (typeof priv.docid === "string" &&
!priv.docid.match("^[^\/]+([\/][^\/]+)?$")) {
if (typeof priv.doc._id === "string" &&
!priv.doc._id.match("^[^\/]+([\/][^\/]+)?$")) {
that.error({
status: 21,
statusText: 'Invalid Document Id',
......@@ -563,9 +596,14 @@ var command = function (spec, my) {
*/
that.executeOn = function (storage) {};
that.success = function (return_value) {
var i;
priv.on_going = false;
priv.success(return_value);
for (i = 0; i < priv.success.length; i += 1) {
priv.success[i](return_value);
}
priv.end(doneStatus());
priv.success = [];
priv.error = [];
};
that.retry = function (return_error) {
priv.on_going = false;
......@@ -576,13 +614,31 @@ var command = function (spec, my) {
}
};
that.error = function (return_error) {
var i;
priv.on_going = false;
priv.error(return_error);
for (i = 0; i < priv.error.length; i += 1) {
priv.error[i](return_error);
}
priv.end(failStatus());
priv.success = [];
priv.error = [];
};
that.end = function () {
priv.end(doneStatus());
};
that.addCallbacks = function (success, error) {
if (arguments.length > 1) {
priv.success.push(success || function () {});
priv.error.push(error || function () {});
} else {
priv.success.push(function (response) {
(success || function () {})(undefined, response);
});
priv.error.push(function (err) {
(success || function () {})(err, undefined);
});
}
};
that.onSuccessDo = function (fun) {
if (fun) {
priv.success = fun;
......@@ -639,6 +695,58 @@ var command = function (spec, my) {
};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global command: true */
var getAttachmentCommand = function (spec, my) {
var that = command(spec, my);
spec = spec || {};
my = my || {};
// Attributes //
// Methods //
that.getLabel = function () {
return 'getAttachment';
};
that.executeOn = function (storage) {
storage.getAttachment(that);
};
that.validateState = function () {
if (!(typeof that.getDocId() === "string" && that.getDocId() !==
"")) {
that.error({
"status": 20,
"statusText": "Document Id Required",
"error": "document_id_required",
"message": "The document id is not provided",
"reason": "Document id is undefined"
});
return false;
}
if (typeof that.getAttachmentId() !== "string") {
that.error({
"status": 22,
"statusText": "Attachment Id Required",
"error": "attachment_id_required",
"message": "The attachment id must be set",
"reason": "Attachment id not set"
});
return false;
}
if (that.getAttachmentId() === "") {
that.error({
"status": 23,
"statusText": "Invalid Attachment Id",
"error": "invalid_attachment_id",
"message": "The attachment id must not be an empty string",
"reason": "Attachment id is empty"
});
}
return true;
};
return that;
};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global command: true */
var getCommand = function (spec, my) {
var that = command(spec, my);
......@@ -662,18 +770,6 @@ var getCommand = function (spec, my) {
});
return false;
}
if (typeof that.getAttachmentId() === "string") {
if (that.getAttachmentId() === "") {
that.error({
"status": 23,
"statusText": "Invalid Attachment Id",
"error": "invalid_attachment_id",
"message": "The attachment id must not be an empty string",
"reason": "Attachment id is empty"
});
return false;
}
}
return true;
};
......@@ -701,17 +797,6 @@ var postCommand = function (spec, my) {
};
that.validateState = function () {
if (that.getAttachmentId() !== undefined) {
that.error({
"status": 21,
"statusText": "Invalid Document Id",
"error": "invalid_document_id",
"message": "The document id contains '/' characters " +
"which are forbidden",
"reason": "Document id contains '/' character(s)"
});
return false;
}
return true;
};
that.executeOn = function (storage) {
......@@ -795,22 +880,63 @@ var putCommand = function (spec, my) {
});
return false;
}
if (that.getAttachmentId() !== undefined) {
return true;
};
that.executeOn = function (storage) {
storage.put(that);
};
return that;
};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global command: true */
var removeAttachmentCommand = function (spec, my) {
var that = command(spec, my);
spec = spec || {};
my = my || {};
// Attributes //
// Methods //
that.getLabel = function () {
return 'removeAttachment';
};
that.executeOn = function (storage) {
storage.removeAttachment(that);
};
that.validateState = function () {
if (!(typeof that.getDocId() === "string" && that.getDocId() !==
"")) {
that.error({
"status": 20,
"statusText": "Document Id Required",
"error": "document_id_required",
"message": "The document id is not provided",
"reason": "Document id is undefined"
});
return false;
}
if (typeof that.getAttachmentId() !== "string") {
that.error({
"status": 21,
"statusText": "Invalid Document Id",
"error": "invalid_document_id",
"message": "The document id contains '/' characters " +
"which are forbidden",
"reason": "Document id contains '/' character(s)"
"status": 22,
"statusText": "Attachment Id Required",
"error": "attachment_id_required",
"message": "The attachment id must be set",
"reason": "Attachment id not set"
});
return false;
}
if (that.getAttachmentId() === "") {
that.error({
"status": 23,
"statusText": "Invalid Attachment Id",
"error": "invalid_attachment_id",
"message": "The attachment id must not be an empty string",
"reason": "Attachment id is empty"
});
}
return true;
};
that.executeOn = function (storage) {
storage.put(that);
};
return that;
};
/*jslint indent: 2, maxlen: 80, sloppy: true */
......@@ -837,18 +963,6 @@ var removeCommand = function (spec, my) {
});
return false;
}
if (typeof that.getAttachmentId() === "string") {
if (that.getAttachmentId() === "") {
that.error({
"status": 23,
"statusText": "Invalid Attachment Id",
"error": "invalid_attachment_id",
"message": "The attachment id must not be an empty string",
"reason": "Attachment id is empty"
});
return false;
}
}
return true;
};
......@@ -859,6 +973,37 @@ var removeCommand = function (spec, my) {
return that;
};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global command: true */
var repairCommand = function (spec, my) {
var that = command(spec, my);
spec = spec || {};
my = my || {};
// Methods //
that.getLabel = function () {
return 'repair';
};
that.validateState = function () {
if (!(typeof that.getDocId() === "string" && that.getDocId() !==
"")) {
that.error({
"status": 20,
"statusText": "Document Id Required",
"error": "document_id_required",
"message": "The document id is not provided",
"reason": "Document id is undefined"
});
return false;
}
return true;
};
that.executeOn = function (storage) {
storage.repair(that);
};
return that;
};
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global jobStatus: true */
var doneStatus = function (spec, my) {
var that = jobStatus(spec, my);
......@@ -1236,16 +1381,9 @@ var job = function (spec) {
* @param {object} job The other job.
*/
that.update = function (job) {
priv.command.error({
status: 12,
statusText: 'Replaced',
error: 'replaced',
message: 'Job has been replaced by another one.',
reason: 'job has been replaced by another one'
});
priv.command.addCallbacks(job.getCommand().onSuccessDo()[0],
job.getCommand().onErrorDo()[0]);
priv.date = new Date(job.getDate().getTime());
priv.command = job.getCommand();
priv.status = job.getStatus();
};
/**
......@@ -1789,7 +1927,7 @@ var jobRules = (function () {
return 'wait';
}
});
Object.defineProperty(that, "none", {
Object.defineProperty(that, "ok", {
configurable: false,
enumerable: false,
writable: false,
......@@ -1797,17 +1935,66 @@ var jobRules = (function () {
return 'none';
}
});
that.default_action = that.none;
that.default_action = that.ok;
that.default_compare = function (job1, job2) {
return (job1.getCommand().getDocId() === job2.getCommand().getDocId() &&
job1.getCommand().getDocInfo('_rev') ===
job2.getCommand().getDocInfo('_rev') &&
job1.getCommand().getOption('rev') ===
job2.getCommand().getOption('rev') &&
JSON.stringify(job1.getStorage().serialized()) ===
JSON.stringify(job2.getStorage().serialized()));
return job1.getId() !== job2.getId() &&
job1.getStatus().getLabel() !== "done" &&
job1.getStatus().getLabel() !== "fail" &&
JSON.stringify(job1.getStorage().serialized()) ===
JSON.stringify(job2.getStorage().serialized());
};
// Compare Functions //
Object.defineProperty(that, "sameDocumentId", {
configurable: false,
enumerable: false,
writable: false,
value: function (job1, job2) {
return job1.getCommand().getDocId() === job2.getCommand().getDocId();
}
});
Object.defineProperty(that, "sameRevision", {
configurable: false,
enumerable: false,
writable: false,
value: function (job1, job2) {
return job1.getCommand().getDocInfo("_rev") ===
job2.getCommand().getDocInfo("_rev");
}
});
Object.defineProperty(that, "sameAttachmentId", {
configurable: false,
enumerable: false,
writable: false,
value: function (job1, job2) {
return job1.getCommand().getAttachmentId() ===
job2.getCommand().getAttachmentId();
}
});
Object.defineProperty(that, "sameDocument", {
configurable: false,
enumerable: false,
writable: false,
value: function (job1, job2) {
return JSON.stringify(job1.getCommand().cloneDoc()) ===
JSON.stringify(job2.getCommand().cloneDoc());
}
});
Object.defineProperty(that, "sameOption", {
configurable: false,
enumerable: false,
writable: false,
value: function (job1, job2) {
return JSON.stringify(job1.getCommand().cloneOption()) ===
JSON.stringify(job2.getCommand().cloneOption());
}
});
// Methods //
/**
* Returns an action according the jobs given in parameters.
......@@ -1817,16 +2004,28 @@ var jobRules = (function () {
* @return {string} An action string.
*/
priv.getAction = function (job1, job2) {
var j1label, j2label, j1status;
j1label = job1.getCommand().getLabel();
j2label = job2.getCommand().getLabel();
j1status = (job1.getStatus().getLabel() === 'on going' ?
'on going' : 'not on going');
if (priv.action[j1label] && priv.action[j1label][j1status] &&
priv.action[j1label][j1status][j2label]) {
return priv.action[j1label][j1status][j2label](job1, job2);
var method1, method2, tmp = priv.action, i, j, condition_list = [], res;
method1 = job1.getCommand().getLabel();
method2 = job2.getCommand().getLabel();
tmp = tmp[method1] = tmp[method1] || {};
tmp = tmp[method2] = tmp[method2] || [];
for (i = 0; i < tmp.length; i += 1) {
// browsing all method1 method2 rules
condition_list = tmp[i].condition_list;
res = true;
for (j = 0; j < condition_list.length; j += 1) {
// test all the rule's conditions
if (!condition_list[j](job1, job2)) {
res = false;
break;
}
}
if (res) {
// if all respects condition list, then action
return tmp[i].rule();
}
}
return that.default_action(job1, job2);
return that.default_action();
};
/**
......@@ -1837,10 +2036,11 @@ var jobRules = (function () {
* @return {boolean} true if comparable, else false.
*/
priv.canCompare = function (job1, job2) {
var job1label = job1.getCommand().getLabel(),
job2label = job2.getCommand().getLabel();
if (priv.compare[job1label] && priv.compare[job2label]) {
return priv.compare[job1label][job2label](job1, job2);
var method1, method2;
method1 = job1.getCommand().getLabel();
method2 = job2.getCommand().getLabel();
if (priv.compare[method1] && priv.compare[method1][method2]) {
return priv.compare[method1][method2](job1, job2);
}
return that.default_compare(job1, job2);
};
......@@ -1882,11 +2082,14 @@ var jobRules = (function () {
configurable: false,
enumerable: false,
writable: false,
value: function (method1, ongoing, method2, rule) {
var ongoing_s = (ongoing ? 'on going' : 'not on going');
priv.action[method1] = priv.action[method1] || {};
priv.action[method1][ongoing_s] = priv.action[method1][ongoing_s] || {};
priv.action[method1][ongoing_s][method2] = rule;
value: function (method1, method2, condition_list, rule) {
var tmp = priv.action;
tmp = tmp[method1] = tmp[method1] || {};
tmp = tmp[method2] = tmp[method2] || [];
tmp.push({
"condition_list": condition_list,
"rule": rule
});
}
});
......@@ -1910,112 +2113,86 @@ var jobRules = (function () {
////////////////////////////////////////////////////////////////////////////
// Adding some rules
/*
LEGEND:
- s: storage
- m: method
- n: name
- c: content
- o: options
- =: are equal
- !: are not equal
select ALL s= n=
removefailordone fail|done
/ elim repl nacc wait
Remove !ongoing Save 1 x x x
Save !ongoing Remove 1 x x x
GetList !ongoing GetList 0 1 x x
Remove !ongoing Remove 0 1 x x
Load !ongoing Load 0 1 x x
Save c= !ongoing Save 0 1 x x
Save c! !ongoing Save 0 1 x x
GetList ongoing GetList 0 0 1 x
Remove ongoing Remove 0 0 1 x
Remove ongoing Load 0 0 1 x
Remove !ongoing Load 0 0 1 x
Load ongoing Load 0 0 1 x
Save c= ongoing Save 0 0 1 x
Remove ongoing Save 0 0 0 1
Load ongoing Remove 0 0 0 1
Load ongoing Save 0 0 0 1
Load !ongoing Remove 0 0 0 1
Load !ongoing Save 0 0 0 1
Save ongoing Remove 0 0 0 1
Save ongoing Load 0 0 0 1
Save c! ongoing Save 0 0 0 1
Save !ongoing Load 0 0 0 1
GetList ongoing Remove 0 0 0 0
GetList ongoing Load 0 0 0 0
GetList ongoing Save 0 0 0 0
GetList !ongoing Remove 0 0 0 0
GetList !ongoing Load 0 0 0 0
GetList !ongoing Save 0 0 0 0
Remove ongoing GetList 0 0 0 0
Remove !ongoing GetList 0 0 0 0
Load ongoing GetList 0 0 0 0
Load !ongoing GetList 0 0 0 0
Save ongoing GetList 0 0 0 0
Save !ongoing GetList 0 0 0 0
For more information, see documentation
*/
that.addActionRule('post', true, 'post', that.dontAccept);
that.addActionRule('post', true, 'put', that.wait);
that.addActionRule('post', true, 'get', that.wait);
that.addActionRule('post', true, 'remove', that.wait);
that.addActionRule('post', true, 'putAttachment', that.wait);
that.addActionRule('post', false, 'post', that.update);
that.addActionRule('post', false, 'put', that.wait);
that.addActionRule('post', false, 'get', that.wait);
that.addActionRule('post', false, 'remove', that.eliminate);
that.addActionRule('post', false, 'putAttachment', that.wait);
that.addActionRule('put', true, 'post', that.dontAccept);
that.addActionRule('put', true, 'put', that.wait);
that.addActionRule('put', true, 'get', that.wait);
that.addActionRule('put', true, 'remove', that.wait);
that.addActionRule('put', true, 'putAttachment', that.wait);
that.addActionRule('put', false, 'post', that.dontAccept);
that.addActionRule('put', false, 'put', that.update);
that.addActionRule('put', false, 'get', that.wait);
that.addActionRule('put', false, 'remove', that.eliminate);
that.addActionRule('put', false, 'putAttachment', that.wait);
that.addActionRule('get', true, 'post', that.wait);
that.addActionRule('get', true, 'put', that.wait);
that.addActionRule('get', true, 'get', that.dontAccept);
that.addActionRule('get', true, 'remove', that.wait);
that.addActionRule('get', true, 'putAttachment', that.wait);
that.addActionRule('get', false, 'post', that.wait);
that.addActionRule('get', false, 'put', that.wait);
that.addActionRule('get', false, 'get', that.update);
that.addActionRule('get', false, 'remove', that.wait);
that.addActionRule('get', false, 'putAttachment', that.wait);
that.addActionRule('remove', true, 'post', that.wait);
that.addActionRule('remove', true, 'get', that.dontAccept);
that.addActionRule('remove', true, 'remove', that.dontAccept);
that.addActionRule('remove', true, 'putAttachment', that.dontAccept);
that.addActionRule('remove', false, 'post', that.eliminate);
that.addActionRule('remove', false, 'put', that.dontAccept);
that.addActionRule('remove', false, 'get', that.dontAccept);
that.addActionRule('remove', false, 'remove', that.update);
that.addActionRule('remove', false, 'putAttachment', that.dontAccept);
that.addActionRule('allDocs', true, 'allDocs', that.dontAccept);
that.addActionRule('allDocs', false, 'allDocs', that.update);
that.addActionRule('putAttachment', true, 'post', that.dontAccept);
that.addActionRule('putAttachment', true, 'put', that.wait);
that.addActionRule('putAttachment', true, 'get', that.wait);
that.addActionRule('putAttachment', true, 'remove', that.wait);
that.addActionRule('putAttachment', true, 'putAttachment', that.wait);
that.addActionRule('putAttachment', false, 'post', that.dontAccept);
that.addActionRule('putAttachment', false, 'put', that.wait);
that.addActionRule('putAttachment', false, 'get', that.wait);
that.addActionRule('putAttachment', false, 'remove', that.eliminate);
that.addActionRule('putAttachment', false, 'putAttachment', that.update);
Rules
original job |job to add |condition |action
post post same doc update
" " same docid, same rev wait
" put same doc update
" " same docid, same rev wait
" putA " wait
" remove " "
put post same doc update
" " same docid, same rev wait
" put same doc update
" " same docid, same rev wait
" putA " "
" remove " "
putA post same docid, same rev wait
" put " "
" putA same doc update
" " same docid, same rev, same attmt wait
" remove same docid, same rev "
remove post same docid, same rev wait
" put " "
" putA " "
" remove " update
get get same doc, same options update
allDocs allDocs same doc, same options update
*/
that.addActionRule("post", "post", [that.sameDocument], that.update);
that.addActionRule("post", "post",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("post", "put", [that.sameDocument], that.update);
that.addActionRule("post", "put",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("post", "putAttachment",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("post", "remove",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("put", "post", [that.sameDocument], that.update);
that.addActionRule("put", "post",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("put", "put", [that.sameDocument], that.update);
that.addActionRule("put", "put",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("put", "putAttachment",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("put", "remove",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("putAttachment", "post",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("putAttachment", "put",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("putAttachment", "putAttachment", [that.sameDocument],
that.update);
that.addActionRule("putAttachment", "putAttachment", [
that.sameDocumentId,
that.sameRevision,
that.sameAttachmentId
], that.wait);
that.addActionRule("putAttachment", "remove",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("remove", "post",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("remove", "put",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("remove", "putAttachment",
[that.sameDocumentId, that.sameRevision], that.wait);
that.addActionRule("remove", "remove",
[that.sameDocumentId, that.sameRevision], that.update);
that.addActionRule("get", "get",
[that.sameDocument, that.sameOption], that.update);
that.addActionRule("allDocs", "allDocs",
[that.sameDocument, that.sameOption], that.update);
// end adding rules
////////////////////////////////////////////////////////////////////////////
return that;
......@@ -2026,7 +2203,8 @@ var jobRules = (function () {
storage_type_object: true, invalidStorageType: true, jobRules: true,
job: true, postCommand: true, putCommand: true, getCommand:true,
allDocsCommand: true, putAttachmentCommand: true,
removeCommand: true */
getAttachmentCommand: true, removeAttachmentCommand: true,
removeCommand: true, checkCommand: true, repairCommand: true */
// Class jio
var that = {}, priv = {}, jio_id_array_name = 'jio/id_array';
spec = spec || {};
......@@ -2235,12 +2413,13 @@ priv.addJob = function (commandCreator, spec) {
* Post a document.
* @method post
* @param {object} doc The document object. Contains at least:
* - {string} _id The document id (optional), "/" are forbidden
* - {string} _id The document id (optional)
* For revision managing: choose at most one of the following informations:
* - {string} _rev The revision we want to update
* - {string} _revs_info The revision information we want the document to have
* - {string} _revs The revision history we want the document to have
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* - {boolean} revs Include revision history of the document.
* - {boolean} revs_info Retreive the revisions.
* - {boolean} conflicts Retreive the conflict list.
* @param {function} callback (optional) The callback(err,response).
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
......@@ -2268,12 +2447,13 @@ Object.defineProperty(that, "post", {
* Put a document.
* @method put
* @param {object} doc The document object. Contains at least:
* - {string} _id The document id, "/" are forbidden
* - {string} _id The document id
* For revision managing: choose at most one of the following informations:
* - {string} _rev The revision we want to update
* - {string} _revs_info The revision information we want the document to have
* - {string} _revs The revision history we want the document to have
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* - {boolean} revs Include revision history of the document.
* - {boolean} revs_info Retreive the revisions.
* - {boolean} conflicts Retreive the conflict list.
* @param {function} callback (optional) The callback(err,response).
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
......@@ -2300,10 +2480,13 @@ Object.defineProperty(that, "put", {
/**
* Get a document.
* @method get
* @param {string} docid The document id: "doc_id" or "doc_id/attachmt_id".
* @param {string} doc The document object. Contains at least:
* - {string} _id The document id
* For revision managing:
* - {string} _rev The revision we want to get. (optional)
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* - {string} rev The revision we want to get.
* For revision managing:
* - {boolean} revs Include revision history of the document.
* - {boolean} revs_info Include list of revisions, and their availability.
* - {boolean} conflicts Include a list of conflicts.
......@@ -2316,14 +2499,14 @@ Object.defineProperty(that, "get", {
configurable: false,
enumerable: false,
writable: false,
value: function (id, options, success, error) {
value: function (doc, options, success, error) {
var param = priv.parametersToObject(
[options, success, error],
{max_retry: 3}
);
priv.addJob(getCommand, {
docid: id,
doc: doc,
options: param.options,
callbacks: {success: param.success, error: param.error}
});
......@@ -2334,12 +2517,11 @@ Object.defineProperty(that, "get", {
* Remove a document.
* @method remove
* @param {object} doc The document object. Contains at least:
* - {string} _id The document id: "doc_id" or "doc_id/attachment_id"
* - {string} _id The document id
* For revision managing:
* - {string} _rev The revision we want to remove
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* - {boolean} revs Include revision history of the document.
* - {boolean} revs_info Include list of revisions, and their availability.
* - {boolean} conflicts Include a list of conflicts.
* @param {function} callback (optional) The callback(err,response).
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
......@@ -2369,9 +2551,6 @@ Object.defineProperty(that, "remove", {
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* - {boolean} include_docs Include document metadata
* - {boolean} revs Include revision history of the document.
* - {boolean} revs_info Include revisions.
* - {boolean} conflicts Include conflicts.
* @param {function} callback (optional) The callback(err,response).
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
......@@ -2394,19 +2573,51 @@ Object.defineProperty(that, "allDocs", {
}
});
/**
* Get an attachment from a document.
* @method gettAttachment
* @param {object} doc The document object. Contains at least:
* - {string} _id The document id
* - {string} _attachment The attachment id
* For revision managing:
* - {string} _rev The document revision
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* @param {function} callback (optional) The callback(err,respons)
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
* called on success.
*/
Object.defineProperty(that, "getAttachment", {
configurable: false,
enumerable: false,
writable: false,
value: function (doc, options, success, error) {
var param = priv.parametersToObject(
[options, success, error],
{max_retry: 3}
);
priv.addJob(getAttachmentCommand, {
doc: doc,
options: param.options,
callbacks: {success: param.success, error: param.error}
});
}
});
/**
* Put an attachment to a document.
* @method putAttachment
* @param {object} doc The document object. Contains at least:
* - {string} id The document id: "doc_id/attchment_id"
* - {string} data Base64 attachment data
* - {string} mimetype The attachment mimetype
* - {string} rev The attachment revision
* - {string} _id The document id
* - {string} _attachment The attachment id
* - {string} _data The attachment data
* - {string} _mimetype The attachment mimetype
* For revision managing:
* - {string} _rev The document revision
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* - {boolean} revs Include revision history of the document.
* - {boolean} revs_info Include revisions.
* - {boolean} conflicts Include conflicts.
* @param {function} callback (optional) The callback(err,respons)
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
......@@ -2417,19 +2628,106 @@ Object.defineProperty(that, "putAttachment", {
enumerable: false,
writable: false,
value: function (doc, options, success, error) {
var param, k, doc_with_underscores = {};
param = priv.parametersToObject(
var param = priv.parametersToObject(
[options, success, error],
{max_retry: 0}
);
for (k in doc) {
if (doc.hasOwnProperty(k) && k.match('[^_].*')) {
doc_with_underscores["_" + k] = doc[k];
}
}
priv.addJob(putAttachmentCommand, {
doc: doc_with_underscores,
doc: doc,
options: param.options,
callbacks: {success: param.success, error: param.error}
});
}
});
/**
* Put an attachment to a document.
* @method putAttachment
* @param {object} doc The document object. Contains at least:
* - {string} _id The document id
* - {string} _attachment The attachment id
* For revision managing:
* - {string} _rev The document revision
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* @param {function} callback (optional) The callback(err,respons)
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
* called on success.
*/
Object.defineProperty(that, "removeAttachment", {
configurable: false,
enumerable: false,
writable: false,
value: function (doc, options, success, error) {
var param = priv.parametersToObject(
[options, success, error],
{max_retry: 0}
);
priv.addJob(removeAttachmentCommand, {
doc: doc,
options: param.options,
callbacks: {success: param.success, error: param.error}
});
}
});
/**
* Check a document.
* @method check
* @param {object} doc The document object. Contains at least:
* - {string} _id The document id
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* @param {function} callback (optional) The callback(err,response).
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
* called on success.
*/
Object.defineProperty(that, "check", {
configurable: false,
enumerable: false,
writable: false,
value: function (doc, options, success, callback) {
var param = priv.parametersToObject(
[options, success, callback],
{max_retry: 3}
);
priv.addJob(checkCommand, {
doc: doc,
options: param.options,
callbacks: {success: param.success, error: param.error}
});
}
});
/**
* Repair a document.
* @method repair
* @param {object} doc The document object. Contains at least:
* - {string} _id The document id
* @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity.
* @param {function} callback (optional) The callback(err,response).
* @param {function} error (optional) The callback on error, if this
* callback is given in parameter, "callback" is changed as "success",
* called on success.
*/
Object.defineProperty(that, "repair", {
configurable: false,
enumerable: false,
writable: false,
value: function (doc, options, success, callback) {
var param = priv.parametersToObject(
[options, success, callback],
{max_retry: 3}
);
priv.addJob(repairCommand, {
doc: doc,
options: param.options,
callbacks: {success: param.success, error: param.error}
});
......
/*global window, define */
(function () {
'use strict';
var jioWaitStorageLoader = function (jIO) {
var newWaitStorage = function (spec, my) {
var that = my.basicStorage(spec, my),
priv = {},
validatestate_sub_storage = spec.storage || false;
priv.sub_storage_spec = spec.storage || {
type: 'base'
};
priv.delay = spec.delay || 5000;
priv.save = spec.save || true;
priv.load = spec.load || false;
priv.getlist = spec.getlist || false;
priv.remove = spec.remove || false;
that.validateState = function () {
if (!validatestate_sub_storage) {
return 'Need at least one parameter: "storage" ' +
'containing storage specifications.';
}
return '';
};
that.specToStore = function () {
var o = {};
o.delay = priv.delay;
o.storage = priv.sub_storage_spec;
o.save = priv.save;
o.load = priv.load;
o.getlist = priv.getlist;
o.remove = priv.remove;
return o;
};
priv.doJob = function (command, timeout_or_not_timeout) {
var delay = 0;
if (timeout_or_not_timeout) {
delay = priv.delay;
}
window.setTimeout(function () {
that.addJob(that.newStorage(priv.sub_storage_spec),
command);
that.end();
}, delay);
};
that.saveDocument = function (command) {
priv.doJob(command, priv.save);
};
// end saveDocument
that.loadDocument = function (command) {
priv.doJob(command, priv.load);
};
// end loadDocument
that.getDocumentList = function (command) {
priv.doJob(command, priv.getlist);
};
// end getDocumentList
that.removeDocument = function (command) {
priv.doJob(command, priv.remove);
};
// end removeDocument
return that;
};
jIO.addStorageType('wait', newWaitStorage);
};
if (window.requirejs) {
define('JIOWaitStorages', ['jIO'], jioWaitStorageLoader);
} else {
jioWaitStorageLoader(jIO);
}
}
());
\ No newline at end of file
......@@ -203,58 +203,104 @@ jIO.addStorageType('local', function (spec, my) {
localstorage.setItem(priv.localpath + "/" + command.getDocId(), doc);
that.success({
"ok": true,
"id": command.getDocId() + "/" + command.getAttachmentId()
"id": command.getDocId(),
"attachment": command.getAttachmentId()
});
});
};
/**
* Get a document or attachment
* Get a document
* @method get
* @param {object} command The JIO command
*/
that.get = function (command) {
setTimeout(function () {
var doc;
if (typeof command.getAttachmentId() === "string") {
// seeking for an attachment
doc = localstorage.getItem(priv.localpath + "/" + command.getDocId() +
"/" + command.getAttachmentId());
if (doc !== null) {
that.success(doc);
} else {
that.error({
"status": 404,
"statusText": "Not Found",
"error": "not_found",
"message": "Cannot find the attachment",
"reason": "Attachment does not exist"
});
}
var doc = localstorage.getItem(priv.localpath + "/" + command.getDocId());
if (doc !== null) {
that.success(doc);
} else {
// seeking for a document
doc = localstorage.getItem(priv.localpath + "/" + command.getDocId());
if (doc !== null) {
that.success(doc);
} else {
that.error({
"status": 404,
"statusText": "Not Found",
"error": "not_found",
"message": "Cannot find the document",
"reason": "Document does not exist"
});
}
that.error({
"status": 404,
"statusText": "Not Found",
"error": "not_found",
"message": "Cannot find the document",
"reason": "Document does not exist"
});
}
});
};
/**
* Remove a document or attachment
* Get a attachment
* @method getAttachment
* @param {object} command The JIO command
*/
that.getAttachment = function (command) {
setTimeout(function () {
var doc = localstorage.getItem(priv.localpath + "/" + command.getDocId() +
"/" + command.getAttachmentId());
if (doc !== null) {
that.success(doc);
} else {
that.error({
"status": 404,
"statusText": "Not Found",
"error": "not_found",
"message": "Cannot find the attachment",
"reason": "Attachment does not exist"
});
}
});
};
/**
* Remove a document
* @method remove
* @param {object} command The JIO command
*/
that.remove = function (command) {
setTimeout(function () {
var doc, i, attachment_list;
doc = localstorage.getItem(priv.localpath + "/" + command.getDocId());
attachment_list = [];
if (doc !== null && typeof doc === "object") {
if (typeof doc._attachments === "object") {
// prepare list of attachments
for (i in doc._attachments) {
if (doc._attachments.hasOwnProperty(i)) {
attachment_list.push(i);
}
}
}
} else {
return that.error({
"status": 404,
"statusText": "Not Found",
"error": "not_found",
"message": "Document not found",
"reason": "missing"
});
}
localstorage.removeItem(priv.localpath + "/" + command.getDocId());
// delete all attachments
for (i = 0; i < attachment_list.length; i += 1) {
localstorage.removeItem(priv.localpath + "/" + command.getDocId() +
"/" + attachment_list[i]);
}
that.success({
"ok": true,
"id": command.getDocId()
});
});
};
/**
* Remove an attachment
* @method removeAttachment
* @param {object} command The JIO command
*/
that.removeAttachment = function (command) {
setTimeout(function () {
var doc, error, i, attachment_list;
error = function (word) {
......@@ -267,55 +313,29 @@ jIO.addStorageType('local', function (spec, my) {
});
};
doc = localstorage.getItem(priv.localpath + "/" + command.getDocId());
if (typeof command.getAttachmentId() === "string") {
// remove attachment from document
if (doc !== null && typeof doc === "object" &&
typeof doc._attachments === "object") {
if (typeof doc._attachments[command.getAttachmentId()] ===
"object") {
delete doc._attachments[command.getAttachmentId()];
if (priv.objectIsEmpty(doc._attachments)) {
delete doc._attachments;
}
localstorage.setItem(priv.localpath + "/" + command.getDocId(),
doc);
localstorage.removeItem(priv.localpath + "/" + command.getDocId() +
"/" + command.getAttachmentId());
that.success({
"ok": true,
"id": command.getDocId() + "/" + command.getAttachmentId()
});
} else {
error("Attachment");
// remove attachment from document
if (doc !== null && typeof doc === "object" &&
typeof doc._attachments === "object") {
if (typeof doc._attachments[command.getAttachmentId()] ===
"object") {
delete doc._attachments[command.getAttachmentId()];
if (priv.objectIsEmpty(doc._attachments)) {
delete doc._attachments;
}
localstorage.setItem(priv.localpath + "/" + command.getDocId(),
doc);
localstorage.removeItem(priv.localpath + "/" + command.getDocId() +
"/" + command.getAttachmentId());
that.success({
"ok": true,
"id": command.getDocId(),
"attachment": command.getAttachmentId()
});
} else {
error("Document");
error("Attachment");
}
} else {
// seeking for a document
attachment_list = [];
if (doc !== null && typeof doc === "object") {
if (typeof doc._attachments === "object") {
// prepare list of attachments
for (i in doc._attachments) {
if (doc._attachments.hasOwnProperty(i)) {
attachment_list.push(i);
}
}
}
} else {
return error("Document");
}
localstorage.removeItem(priv.localpath + "/" + command.getDocId());
// delete all attachments
for (i = 0; i < attachment_list.length; i += 1) {
localstorage.removeItem(priv.localpath + "/" + command.getDocId() +
"/" + attachment_list[i]);
}
that.success({
"ok": true,
"id": command.getDocId()
});
error("Document");
}
});
};
......@@ -361,21 +381,11 @@ jIO.addStorageType('local', function (spec, my) {
if (s.test(i)) {
items += 1;
j = i.split('/').slice(-1)[0];
query_object.push(JSON.parse(localStorage.getItem(i)));
query_object.push(localstorage.getItem(i));
}
}
}
query_response = jIO.ComplexQueries.query({
query: query_syntax.query,
filter: {
sort_on: query_syntax.filter.sort_on,
limit: query_syntax.filter.limit,
select_list: query_syntax.filter.select_list
},
wildcard_character: query_syntax.wildcard_character
},
query_object
);
query_response = jIO.ComplexQueries.query(query_syntax, query_object);
that.success(query_response);
}
};
......
......@@ -542,6 +542,7 @@ $.widget.bridge = function( name, object ) {
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
......@@ -8481,7 +8482,6 @@ $( document ).bind( "pagecreate create", function( e ) {
$.widget( "mobile.table", $.mobile.widget, {
options: {
classes: {
table: "ui-table"
......@@ -8503,16 +8503,17 @@ $.widget( "mobile.table", $.mobile.widget, {
initSelector: ":jqmData(role='table')"
},
_create: function() {
var self = this;
self.refresh( true );
},
refresh: function (create) {
var self = this,
trs = this.element.find( "thead tr" ),
o = this.options,
$table = $( this.element[0] ),
$table = $( this.element[0] ),
slotsToFill = $table.parent().find(':jqmData(slot="true")'),
slots, topWrapper, bottomWrapper;
......@@ -8521,58 +8522,58 @@ $.widget( "mobile.table", $.mobile.widget, {
o.eventsOnly = false;
}
if ( o.eventsOnly != false ){
// xxx table
o.themes.header = $table.jqmData("header") || "c";
o.themes.wrapper = $table.jqmData("wrapper") || "a";
o.containers.top = $table.jqmData("top-container") || false;
o.containers.bottom = $table.jqmData("bottom-container") || false;
o.containers.top_grid = $table.jqmData("top-grid") || 3;
o.containers.bottom_grid = $table.jqmData("bottom-grid") || 3;
o.inset = $table.jqmData( "inset" ) || false;
if ( !!o.inset ) {
this.options.classes.table += " ui-table-inset";
// xxx table - corners (not nice, may land on ui-content!);
$table.parent().addClass('ui-corner-all');
}
this.element.addClass( this.options.classes.table );
if ( o.eventsOnly !== false ){
if ( create ) {
// xxx table
o.themes.header = $table.jqmData("header") || "c";
o.themes.wrapper = $table.jqmData("wrapper") || "a";
o.containers.top = $table.jqmData("top-container") || false;
o.containers.bottom = $table.jqmData("bottom-container") || false;
o.containers.top_grid = $table.jqmData("top-grid") || 3;
o.containers.bottom_grid = $table.jqmData("bottom-grid") || 3;
o.inset = $table.jqmData( "inset" ) || false;
if ( !!o.inset ) {
this.options.classes.table += " ui-table-inset";
// xxx table - corners (not nice, may land on ui-content!);
$table.parent().addClass('ui-corner-all');
}
this.element.addClass( this.options.classes.table );
// xxx table - wrapper and slots
if (o.containers.top) {
topWrapper = $('<div />')
.addClass( 'table-top-wrapper ui-body-'+o.themes.wrapper + ( !!o.inset ? ' ui-wrapper-inset' : '') )
.append($.map(new Array( o.containers.top_grid || 3 ), function(){
return $('<div/>');
}))
.grid({ grid: this.options.grid })
.insertBefore($table);
}
// xxx table - wrapper and slots
if (o.containers.top) {
topWrapper = $('<div />')
.addClass( 'table-top-wrapper ui-body-'+o.themes.wrapper + ( !!o.inset ? ' ui-wrapper-inset' : '') )
.append($.map(new Array( o.containers.top_grid || 3 ), function(){
return $('<div/>');
}))
.grid({ grid: this.options.grid })
.insertBefore($table);
}
if (o.containers.bottom) {
bottomWrapper = $('<div />')
.addClass( 'table-bottom-wrapper ui-body-'+o.themes.wrapper + ( !!o.inset ? ' ui-wrapper-inset' : '' ) )
.append($.map(new Array( o.containers.bottom_grid || 3 ), function(){
return $('<div/>');
}))
.grid({ grid: this.options.grid })
.insertAfter($table);
}
if (o.containers.bottom) {
bottomWrapper = $('<div />')
.addClass( 'table-bottom-wrapper ui-body-'+o.themes.wrapper + ( !!o.inset ? ' ui-wrapper-inset' : '' ) )
.append($.map(new Array( o.containers.bottom_grid || 3 ), function(){
return $('<div/>');
}))
.grid({ grid: this.options.grid })
.insertAfter($table);
// xxx table - move slots into grid
slots = $('.table-top-wrapper, .table-bottom-wrapper').children('div');
for ( var i = 0; i < slotsToFill.length; i++){
var currentSlot = slotsToFill.eq(i);
currentSlot
.find('label')
.addClass('ui-hidden-accessible')
.end()
.appendTo( slots.eq( currentSlot.jqmData("slot-id")-1 ) );
};
}
// xxx table - move slots into grid
slots = $('.table-top-wrapper, .table-bottom-wrapper').children('div');
for ( var i = 0; i < slotsToFill.length; i++){
var currentSlot = slotsToFill.eq(i);
currentSlot
.find('label')
.addClass('ui-hidden-accessible')
.end()
.appendTo( slots.eq( currentSlot.jqmData("slot-id")-1 ) );
};
// Expose headers and allHeaders properties on the widget
// headers references the THs within the first TR in the table
// xxx tables - add support for 2nd header row
......@@ -8581,11 +8582,12 @@ $.widget( "mobile.table", $.mobile.widget, {
// allHeaders references headers, plus all THs in the thead, which may include several rows, or not
self.allHeaders = this.element.find( "tr:eq(0)" ).children().add( trs.children() );
var coltally = 0;
trs.each(function(){
var blocktally;
$( this ).children().each(function( i ){
var span = parseInt( $( this ).attr( "colspan" ), 10 ),
sel = ":nth-child(" + ( coltally + 1 ) + ")";
......@@ -8595,18 +8597,27 @@ $.widget( "mobile.table", $.mobile.widget, {
if (span) {
blocktally = span-1;
}
if( blocktally > 0){
blocktally -= 1;
} else {
// Store "cells" data on header as a reference to all cells in the same column as this TH
// xxx tables = replaced trs.eq(0) with trs )
$( this )
.jqmData( "cells", self.element.find( "tr" ).not( trs ).not( this ).children( sel ) );
coltally++;
// Store "cells" data on header as a reference to all cells in the same column as this TH
if (create === undefined) {
$(this).jqmData("cells","");
}
// reload
$( this )
.jqmData( "cells", self.element.find( "tr" ).not( trs ).not( this ).children( sel ) );
coltally++;
}
});
});
// update table modes
if (create === undefined) {
this.element.trigger('tableupdate');
}
}
}
});
......@@ -8643,126 +8654,155 @@ $.mobile.table.prototype.options.classes = $.extend(
}
);
$.mobile.document.delegate( ":jqmData(role='table')", "tablecreate", function() {
$.mobile.document.delegate( ":jqmData(role='table')", "tablecreate tableupdate", function(e) {
var $table = $( this ),
event = e.type,
self = $table.data( "mobile-table" ),
o = self.options,
ns = $.mobile.ns;
ns = $.mobile.ns,
id = ( $table.attr( "id" ) || o.classes.popup ) + "-popup"; //TODO BETTER FALLBACK ID HERE
if( o.mode !== "columntoggle" ){
return;
}
// xxx eventsonly
if ( o.eventsOnly != false ){
// xxx table - add themes
o.columnPopupTheme = $table.jqmData("popup-theme") || o.themes.wrapper || "c";
o.columnBtnTheme = $table.jqmData("popup-btn-theme") || o.themes.wrapper || "c";
self.element.addClass( o.classes.columnToggleTable );
var id = ( $table.attr( "id" ) || o.classes.popup ) + "-popup", //TODO BETTER FALLBACK ID HERE
$menuButton = $( "<a href='#" + id + "' class='" + o.classes.columnBtn + "' data-" + ns + "rel='popup' data-" + ns + "mini='true'>" + o.columnBtnText + "</a>" ),
$popup = $( "<div data-" + ns + "role='popup' data-" + ns + "theme='" + o.themes.wrapper +"' data-" + ns + "role='fieldcontain' class='" + o.classes.popup + "' id='" + id + "'></div>"),
$menu = $("<fieldset data-" + ns + "role='controlgroup'></fieldset>"),
// xxx tables - add sortables and multi row header handler
$sortables = $table.find('th:jqmData(sortable="true")'),
$topCells = $('thead tr').length > 1 ? $("thead tr:first-child th" ).not('[rowspan=2]') : "",
$bottomCells;
if ( o.eventsOnly !== false ){
if ( event !== "tableupdate") {
// xxx table - add themes
o.columnPopupTheme = $table.jqmData("popup-theme") || o.themes.wrapper || "c";
o.columnBtnTheme = $table.jqmData("popup-btn-theme") || o.themes.wrapper || "c";
self.element.addClass( o.classes.columnToggleTable );
var $menuButton = $( "<a href='#" + id + "' class='" + o.classes.columnBtn + "' data-" + ns + "rel='popup' data-" + ns + "mini='true'>" + o.columnBtnText + "</a>" ),
//$popup = $( "<div data-" + ns + "role='popup' data-" + ns + "role='fieldcontain' class='" + o.classes.popup + "' id='" + id + "'></div>"),
$popup = $( "<div data-" + ns + "role='popup' data-" + ns + "role='fieldcontain' class='" + o.classes.popup + "' id='" + id + "'></div>"),
$menu = $("<fieldset data-" + ns + "role='controlgroup'></fieldset>"),
// xxx tables - add sortables and multi row header handler
$sortables = $table.find('th:jqmData(sortable="true")'),
$headerRows = $table.find('thead tr'),
$topCells,
$bottomCells,
$switchboard;
// top/bottom cells
if ($headerRows.length > 1) {
$topCells = $table.find('thead tr:first-child th' ).not('[rowspan=2]');
$bottomCells = $table.find('thead tr:last-child th').length - $table.find('thead tr:last-child th.ui-table-cell-hidden').length;
}
}
// create the hide/show toggles
self.headers.not( "td" ).each(function(){
self.headers.not( "td" ).each(function(i){
var priority = $( this ).jqmData( "priority" ),
$cells = $( this ).add( $( this ).jqmData( "cells" ) );
if( priority ){
$cells.addClass( o.classes.priorityPrefix + priority );
$("<label><input type='checkbox' checked />" + $( this ).text() + "</label>" )
.appendTo( $menu )
.children( 0 )
.jqmData( "cells", $cells )
.checkboxradio({
theme: o.columnPopupTheme
});
if (event !== "tableupdate") {
$("<label><input type='checkbox' checked />" + $( this ).text() + "</label>" )
.appendTo( $menu )
.children( 0 )
.jqmData( "cells", $cells )
.checkboxradio({
theme: o.columnPopupTheme
});
} else {
$('#'+id+ ' fieldset div:eq('+i+')').find('input').jqmData("cells", $cells)
}
}
});
$menu.appendTo( $popup );
}
// bind change event listeners to inputs - TODO: move to a private method?
$menu.on( "change", "input", function( e ){
// xxx table multi header handler
if( this.checked ){
$( this ).jqmData( "cells" ).removeClass( "ui-table-cell-hidden" ).addClass( "ui-table-cell-visible" );
}
else {
$( this ).jqmData( "cells" ).removeClass( "ui-table-cell-visible" ).addClass( "ui-table-cell-hidden" );
if (event !== "tableupdate") {
$menu.appendTo( $popup );
}
}
$bottomCells = $("thead tr:last-child th").length - $("thead tr:last-child th.ui-table-cell-hidden" ).length;
// xxx table multi header handler
// bind change event listeners to inputs - TODO: move to a private method?
if ($menu === undefined) {
$switchboard = $('#'+id+' fieldset');
} else {
$switchboard = $menu;
}
if ($topCells) {
if ($bottomCells === 0) {
$topCells.addClass("ui-table-cell-hidden").removeClass("ui-table-cell-visible");
} else {
$topCells.attr('colspan',$bottomCells).addClass("ui-table-cell-visible");
if (event !== "tableupdate") {
$switchboard.on( "change", "input", function( e ){
// xxx table multi header handler
if( this.checked ){
$( this ).jqmData( "cells" ).removeClass( "ui-table-cell-hidden" ).addClass( "ui-table-cell-visible" );
}
else {
$( this ).jqmData( "cells" ).removeClass( "ui-table-cell-visible" ).addClass( "ui-table-cell-hidden" );
}
}
});
// xxx eventsonly
if ( o.eventsOnly != false ){
// XXX tables - sortable header cells
if ( $sortables.length > 0 ){
for ( var l = 0; l < $sortables.length; l++){
var currentHeader = $sortables.eq(l),
sortTitle = currentHeader.text(),
sortButton =
$( document.createElement( "a" ) )
.text( sortTitle )
.buttonMarkup({
shadow: false,
corners: false,
theme: o.themes.header,
iconpos: "right",
icon: currentHeader.is( '.ui-bottomUp' ) ? "arrow-u" : "arrow-d"
})
.addClass("ui-sortable")
currentHeader
.addClass('ui-btn-up-'+o.headerTheme )
.filter(':jqmData(sortable="true")')
.html( sortButton )
}
}
// xxx table multi header handler
if ($headerRows.length > 1) {
//if ($topCells) {
if ($bottomCells === undefined) {
$topCells.addClass("ui-table-cell-hidden").removeClass("ui-table-cell-visible");
} else {
$topCells.attr('colspan',$bottomCells).addClass("ui-table-cell-visible");
}
//}
}
});
// xxx eventsonly
if ( o.eventsOnly != false ){
// XXX tables - sortable header cells
if ( $sortables.length > 0 ){
for ( var l = 0; l < $sortables.length; l++){
var currentHeader = $sortables.eq(l),
sortTitle = currentHeader.text(),
sortButton =
$( document.createElement( "a" ) )
.text( sortTitle )
.buttonMarkup({
shadow: false,
corners: false,
theme: o.themes.header,
iconpos: "right",
icon: currentHeader.is( '.ui-bottomUp' ) ? "arrow-u" : "arrow-d"
})
.addClass("ui-sortable")
currentHeader
.addClass('ui-btn-up-'+o.headerTheme )
.filter(':jqmData(sortable="true")')
.html( sortButton )
}
}
// xxx table - insert into wrapper or before table
$menuButton[ o.containers.top ? "appendTo" : "insertBefore" ]
( o.containers.top ? $('.table-top-wrapper').children().eq(o.slot-1) : $table )
.buttonMarkup({
theme: o.columnBtnTheme,
// xxx table - add icon/iconpos
icon: $table.jqmData("popup-btn-icon") ||o.columnBtnIcon,
iconpos: $table.jqmData("popup-btn-iconpos") || o.columnBtnIconPos
});
// xxx table - insert into wrapper or before table
$menuButton[ o.containers.top ? "appendTo" : "insertBefore" ]
( o.containers.top ? $('.table-top-wrapper').children().eq(o.slot-1) : $table )
.buttonMarkup({
theme: o.columnBtnTheme,
// xxx table - add icon/iconpos
icon: $table.jqmData("popup-btn-icon") ||o.columnBtnIcon,
iconpos: $table.jqmData("popup-btn-iconpos") || o.columnBtnIconPos
});
$popup
.insertBefore( $table )
.popup();
$popup
.insertBefore( $table )
.popup();
}
}
// refresh method
self.refresh = function(){
$menu.find( "input" ).each( function(){
this.checked = $( this ).jqmData( "cells" ).eq(0).css( "display" ) === "table-cell";
$switchboard.find( "input" ).each( function(){
if (this.checked) {
this.checked = $( this ).jqmData( "cells" ).eq(0).css( "display" ) === "table-cell";
if (event === "tableupdate") {
$( this ).jqmData( "cells" ).addClass('ui-table-cell-visible');
}
} else {
$( this ).jqmData( "cells" ).addClass('ui-table-cell-hidden');
}
$( this ).checkboxradio( "refresh" );
});
};
......@@ -8770,7 +8810,6 @@ $.mobile.document.delegate( ":jqmData(role='table')", "tablecreate", function()
$.mobile.window.on( "throttledresize", self.refresh );
self.refresh();
});
})( jQuery );
......@@ -8787,9 +8826,10 @@ $.mobile.table.prototype.options.classes = $.extend(
}
);
$.mobile.document.delegate( ":jqmData(role='table')", "tablecreate", function() {
$.mobile.document.delegate( ":jqmData(role='table')", "tablecreate tableupdate", function(e) {
var $table = $( this ),
event = e.type,
self = $table.data( "mobile-table" ),
o = self.options;
......@@ -8798,36 +8838,38 @@ $.mobile.document.delegate( ":jqmData(role='table')", "tablecreate", function()
return;
}
self.element.addClass( o.classes.reflowTable );
// get headers in reverse order so that top-level headers are appended last
var reverseHeaders = $( self.allHeaders.get().reverse() );
if ( o.eventsOnly !== false ){
if (event !== "tableupdate") {
self.element.addClass( o.classes.reflowTable );
}
// get headers in reverse order so that top-level headers are appended last
var reverseHeaders = $( self.allHeaders.get().reverse() );
// create the hide/show toggles
reverseHeaders.each(function(i){
var $cells = $( this ).jqmData( "cells" ),
colstart = $( this ).jqmData( "colstart" ),
hierarchyClass = $cells.not( this ).filter( "thead th" ).length && " ui-table-cell-label-top",
text = $(this).text();
// create the hide/show toggles
reverseHeaders.each(function(i){
var $cells = $( this ).jqmData( "cells" ),
colstart = $( this ).jqmData( "colstart" ),
hierarchyClass = $cells.not( this ).filter( "thead th" ).length && " ui-table-cell-label-top",
text = $(this).text();
if( text !== "" ){
if( text !== "" ){
if( hierarchyClass ){
var iteration = parseInt( $( this ).attr( "colspan" ), 10 ),
filter = "";
if( hierarchyClass ){
var iteration = parseInt( $( this ).attr( "colspan" ), 10 ),
filter = "";
if( iteration ){
filter = "td:nth-child("+ iteration +"n + " + ( colstart ) +")";
if( iteration ){
filter = "td:nth-child("+ iteration +"n + " + ( colstart ) +")";
}
$cells.filter( filter ).prepend( "<b class='" + o.classes.cellLabels + hierarchyClass + "'>" + text + "</b>" );
}
else {
$cells.prepend( "<b class='" + o.classes.cellLabels + "'>" + text + "</b>" );
}
$cells.filter( filter ).prepend( "<b class='" + o.classes.cellLabels + hierarchyClass + "'>" + text + "</b>" );
}
else {
$cells.prepend( "<b class='" + o.classes.cellLabels + "'>" + text + "</b>" );
}
}
});
}
});
}
});
})( jQuery );
......@@ -9213,91 +9255,96 @@ $.widget("mobile.filterview", $.mobile.widget, {
search,
onKeyUp = function( e ) {
var $this = $( this ),
val = this.value.toLowerCase(),
ref = $tag === "table" ? $el.children("tbody") : $el,
filterItems = null,
lastval = $this.jqmData( "lastval" ) + "",
childItems = false,
itemtext = "",
item,
// Check if a custom filter callback applies
isCustomFilterCallback = container.options.filterCallback !== defaultFilterCallback;
if ( lastval && lastval === val ) {
// Execute the handler only once per value change
return;
var $this = $( this ),
val = this.value.toLowerCase(),
ref = $tag === "table" ? $el.children("tbody") : $el,
filterItems = null,
lastval = $this.jqmData( "lastval" ) + "",
override = $this.jqmData("overide"),
childItems = false,
itemtext = "",
item,
// Check if a custom filter callback applies
isCustomFilterCallback = container.options.filterCallback !== defaultFilterCallback;
if ( lastval && lastval === val ) {
console.log("KILLED");
// Execute the handler only once per value change
return;
}
}
container._trigger( "beforefilter", "beforefilter", { input: this } );
container._trigger( "beforefilter", "beforefilter", { input: this } );
// Change val as lastval for next execution
$this.jqmData( "lastval" , val );
if ( isCustomFilterCallback || val.length < lastval.length || val.indexOf( lastval ) !== 0 ) {
if ( override ) {
// Change val as lastval for next execution
$this.jqmData( "lastval" , val );
// xxx filter - relate = filter list in panel and main section together
// Custom filter callback applies or removed chars or pasted something totally different, check all items
if ( isCustomFilterCallback || val.length < lastval.length || val.indexOf( lastval ) !== 0 ) {
filterItems = o.filterRelate === undefined ? ref.children() :
ref.children().add( $('[data-related="'+relate+'"]').children() );
} else {
// xxx filter - relate = filter list in panel and main section together
// Custom filter callback applies or removed chars or pasted something totally different, check all items
filterItems = o.filterRelate === undefined ? ref.children() :
ref.children().add( $('[data-related="'+relate+'"]').children() );
} else {
// Only chars added, not removed, only use visible subset
// XXX filter - relate
filterItems = o.filterRelate === undefined ? ref.children( ":not(.ui-screen-hidden)" ) :
ref.children( ":not(.ui-screen-hidden)" ).add( $('[data-related="'+relate+'"]')
.children( ":not(.ui-screen-hidden)" ) );
// Only chars added, not removed, only use visible subset
// XXX filter - relate
filterItems = o.filterRelate === undefined ? ref.children( ":not(.ui-screen-hidden)" ) :
ref.children( ":not(.ui-screen-hidden)" ).add( $('[data-related="'+relate+'"]')
.children( ":not(.ui-screen-hidden)" ) );
if ( !filterItems.length && o.filterReveal ) {
filterItems = ref.children( ".ui-screen-hidden" );
if ( !filterItems.length && o.filterReveal ) {
filterItems = ref.children( ".ui-screen-hidden" );
}
}
}
}
if ( val ) {
// This handles hiding regular rows without the text we search for
// and any list dividers without regular rows shown under it
for ( var i = filterItems.length - 1; i >= 0; i-- ) {
// xxx filter - exclude table head!
item = $( filterItems[ i ] );
itemtext = item.jqmData( "filtertext" ) || item.text();
if ( item.is( "li:jqmData(role=list-divider)" ) ) {
item.toggleClass( "ui-filter-hidequeue" , !childItems );
// New bucket!
childItems = false;
} else if ( container.options.filterCallback( itemtext, val, item ) ) {
//mark to be hidden
item.toggleClass( "ui-filter-hidequeue" , true );
if ( val ) {
// This handles hiding regular rows without the text we search for
// and any list dividers without regular rows shown under it
for ( var i = filterItems.length - 1; i >= 0; i-- ) {
// xxx filter - exclude table head!
item = $( filterItems[ i ] );
itemtext = item.jqmData( "filtertext" ) || item.text();
if ( item.is( "li:jqmData(role=list-divider)" ) ) {
item.toggleClass( "ui-filter-hidequeue" , !childItems );
// New bucket!
childItems = false;
} else if ( container.options.filterCallback( itemtext, val, item ) ) {
//mark to be hidden
item.toggleClass( "ui-filter-hidequeue" , true );
} else {
// There's a shown item in the bucket
childItems = true;
}
}
// Show items, not marked to be hidden
filterItems
.filter( ":not(.ui-filter-hidequeue)" )
.toggleClass( "ui-screen-hidden", false );
// Hide items, marked to be hidden
filterItems
.filter( ".ui-filter-hidequeue" )
.toggleClass( "ui-screen-hidden", true )
.toggleClass( "ui-filter-hidequeue", false );
} else {
// There's a shown item in the bucket
childItems = true;
//filtervalue is empty => show all
filterItems.toggleClass( "ui-screen-hidden", !!o.filterReveal );
}
}
// Show items, not marked to be hidden
filterItems
.filter( ":not(.ui-filter-hidequeue)" )
.toggleClass( "ui-screen-hidden", false );
// Hide items, marked to be hidden
filterItems
.filter( ".ui-filter-hidequeue" )
.toggleClass( "ui-screen-hidden", true )
.toggleClass( "ui-filter-hidequeue", false );
} else {
//filtervalue is empty => show all
filterItems.toggleClass( "ui-screen-hidden", !!o.filterReveal );
}
// xxx filter - tables do not have _addFirstLastClasses! only listview
if ($tag === "listview") {
container._addFirstLastClasses( ref, container._getVisibles( ref, false ), false );
// xxx filter - tables do not have _addFirstLastClasses! only listview
if ($tag === "listview") {
container._addFirstLastClasses( ref, container._getVisibles( ref, false ), false );
}
}
}
}
container.options.filterCallback = defaultFilterCallback;
o.filterSlot = $el.jqmData("filter-slot") || 2;
......
......@@ -12,7 +12,7 @@
// , enforceDefine: true
, paths: {
controller: 'controller'
, text: 'text'
, text: 'text'
, overrides: 'overrides'
, jquery: 'libs/jquery/jquery'
, jqm: 'libs/jqm/jqm'
......@@ -20,7 +20,6 @@
, renderjs: 'plugins/renderjs/renderjs'
, route: 'plugins/route/route'
, url: 'plugins/route/url'
, davstorage: 'libs/jio/davstorage'
, localstorage: 'libs/jio/localstorage'
, queries: 'libs/jio/complex_queries'
, md5: 'libs/jio/md5'
......@@ -30,11 +29,10 @@
'overrides': { deps: ['jquery'] }
, 'jqm': { deps: ['jquery'], exports: 'mobile' }
, 'i18next': { deps: ['jquery'] }
, 'renderjs': { deps: ['jquery', 'jio', 'md5', 'davstorage', 'localstorage', 'queries'] }
, 'renderjs': { deps: ['jquery', 'jio', 'md5', 'localstorage', 'queries'] }
, 'route': { deps: ['jquery', 'render'] }
, 'url': { deps: ['jquery', 'render'] }
, 'jio': { deps: ['md5'] }
, 'davstorage': { deps: ['jio'] }
, 'localstorage': { deps: ['jio'] }
, 'queries': { deps: ['jio'] }
}
......
(function (scope) {
"use strict";
Object.defineProperty(scope, "ComplexQueries", {
configurable: false,
enumerable: false,
writable: false,
value: {}
});
Object.defineProperty(scope.ComplexQueries, "parse", {
configurable: false,
enumerable: false,
writable: false,
value: function (string) {
/*
Default template driver for JS/CC generated parsers running as
browser-based JavaScript/ECMAScript applications.
WARNING: This parser template will not run as console and has lesser
features for debugging than the console derivates for the
various JavaScript platforms.
Features:
- Parser trace messages
- Integrated panic-mode error recovery
Written 2007, 2008 by Jan Max Meyer, J.M.K S.F. Software Technologies
This is in the public domain.
*/
var _dbg_withtrace = false;
var _dbg_string = new String();
function __dbg_print( text )
{
_dbg_string += text + "\n";
}
function __lex( info )
{
var state = 0;
var match = -1;
var match_pos = 0;
var start = 0;
var pos = info.offset + 1;
do
{
pos--;
state = 0;
match = -2;
start = pos;
if( info.src.length <= start )
return 19;
do
{
switch( state )
{
case 0:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 8 ) || ( info.src.charCodeAt( pos ) >= 10 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || info.src.charCodeAt( pos ) == 59 || ( info.src.charCodeAt( pos ) >= 63 && info.src.charCodeAt( pos ) <= 64 ) || ( info.src.charCodeAt( pos ) >= 66 && info.src.charCodeAt( pos ) <= 77 ) || ( info.src.charCodeAt( pos ) >= 80 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 9 ) state = 2;
else if( info.src.charCodeAt( pos ) == 40 ) state = 3;
else if( info.src.charCodeAt( pos ) == 41 ) state = 4;
else if( info.src.charCodeAt( pos ) == 60 || info.src.charCodeAt( pos ) == 62 ) state = 5;
else if( info.src.charCodeAt( pos ) == 34 ) state = 11;
else if( info.src.charCodeAt( pos ) == 79 ) state = 12;
else if( info.src.charCodeAt( pos ) == 32 ) state = 13;
else if( info.src.charCodeAt( pos ) == 61 ) state = 14;
else if( info.src.charCodeAt( pos ) == 65 ) state = 18;
else if( info.src.charCodeAt( pos ) == 78 ) state = 19;
else state = -1;
break;
case 1:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else state = -1;
match = 10;
match_pos = pos;
break;
case 2:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else state = -1;
match = 1;
match_pos = pos;
break;
case 3:
state = -1;
match = 3;
match_pos = pos;
break;
case 4:
state = -1;
match = 4;
match_pos = pos;
break;
case 5:
if( info.src.charCodeAt( pos ) == 61 ) state = 14;
else state = -1;
match = 11;
match_pos = pos;
break;
case 6:
state = -1;
match = 8;
match_pos = pos;
break;
case 7:
state = -1;
match = 9;
match_pos = pos;
break;
case 8:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else state = -1;
match = 6;
match_pos = pos;
break;
case 9:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else state = -1;
match = 5;
match_pos = pos;
break;
case 10:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else state = -1;
match = 7;
match_pos = pos;
break;
case 11:
if( info.src.charCodeAt( pos ) == 34 ) state = 7;
else if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 33 ) || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 91 ) || ( info.src.charCodeAt( pos ) >= 93 && info.src.charCodeAt( pos ) <= 254 ) ) state = 11;
else if( info.src.charCodeAt( pos ) == 92 ) state = 15;
else state = -1;
break;
case 12:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 81 ) || ( info.src.charCodeAt( pos ) >= 83 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else if( info.src.charCodeAt( pos ) == 82 ) state = 8;
else state = -1;
match = 10;
match_pos = pos;
break;
case 13:
state = -1;
match = 1;
match_pos = pos;
break;
case 14:
state = -1;
match = 11;
match_pos = pos;
break;
case 15:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 254 ) ) state = 11;
else state = -1;
break;
case 16:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 67 ) || ( info.src.charCodeAt( pos ) >= 69 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else if( info.src.charCodeAt( pos ) == 68 ) state = 9;
else state = -1;
match = 10;
match_pos = pos;
break;
case 17:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 83 ) || ( info.src.charCodeAt( pos ) >= 85 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else if( info.src.charCodeAt( pos ) == 84 ) state = 10;
else state = -1;
match = 10;
match_pos = pos;
break;
case 18:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 77 ) || ( info.src.charCodeAt( pos ) >= 79 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else if( info.src.charCodeAt( pos ) == 78 ) state = 16;
else state = -1;
match = 10;
match_pos = pos;
break;
case 19:
if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 78 ) || ( info.src.charCodeAt( pos ) >= 80 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;
else if( info.src.charCodeAt( pos ) == 58 ) state = 6;
else if( info.src.charCodeAt( pos ) == 79 ) state = 17;
else state = -1;
match = 10;
match_pos = pos;
break;
}
pos++;
}
while( state > -1 );
}
while( 1 > -1 && match == 1 );
if( match > -1 )
{
info.att = info.src.substr( start, match_pos - start );
info.offset = match_pos;
}
else
{
info.att = new String();
match = -1;
}
return match;
}
function __parse( src, err_off, err_la )
{
var sstack = new Array();
var vstack = new Array();
var err_cnt = 0;
var act;
var go;
var la;
var rval;
var parseinfo = new Function( "", "var offset; var src; var att;" );
var info = new parseinfo();
/* Pop-Table */
var pop_tab = new Array(
new Array( 0/* begin' */, 1 ),
new Array( 13/* begin */, 1 ),
new Array( 12/* search_text */, 1 ),
new Array( 12/* search_text */, 2 ),
new Array( 12/* search_text */, 3 ),
new Array( 14/* and_expression */, 1 ),
new Array( 14/* and_expression */, 3 ),
new Array( 15/* boolean_expression */, 2 ),
new Array( 15/* boolean_expression */, 1 ),
new Array( 16/* expression */, 3 ),
new Array( 16/* expression */, 2 ),
new Array( 16/* expression */, 1 ),
new Array( 17/* value */, 2 ),
new Array( 17/* value */, 1 ),
new Array( 18/* string */, 1 ),
new Array( 18/* string */, 1 )
);
/* Action-Table */
var act_tab = new Array(
/* State 0 */ new Array( 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),
/* State 1 */ new Array( 19/* "$" */,0 ),
/* State 2 */ new Array( 19/* "$" */,-1 ),
/* State 3 */ new Array( 6/* "OR" */,14 , 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 , 19/* "$" */,-2 , 4/* "RIGHT_PARENTHESE" */,-2 ),
/* State 4 */ new Array( 5/* "AND" */,16 , 19/* "$" */,-5 , 7/* "NOT" */,-5 , 3/* "LEFT_PARENTHESE" */,-5 , 8/* "COLUMN" */,-5 , 11/* "OPERATOR" */,-5 , 10/* "WORD" */,-5 , 9/* "STRING" */,-5 , 6/* "OR" */,-5 , 4/* "RIGHT_PARENTHESE" */,-5 ),
/* State 5 */ new Array( 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),
/* State 6 */ new Array( 19/* "$" */,-8 , 7/* "NOT" */,-8 , 3/* "LEFT_PARENTHESE" */,-8 , 8/* "COLUMN" */,-8 , 11/* "OPERATOR" */,-8 , 10/* "WORD" */,-8 , 9/* "STRING" */,-8 , 6/* "OR" */,-8 , 5/* "AND" */,-8 , 4/* "RIGHT_PARENTHESE" */,-8 ),
/* State 7 */ new Array( 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),
/* State 8 */ new Array( 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),
/* State 9 */ new Array( 19/* "$" */,-11 , 7/* "NOT" */,-11 , 3/* "LEFT_PARENTHESE" */,-11 , 8/* "COLUMN" */,-11 , 11/* "OPERATOR" */,-11 , 10/* "WORD" */,-11 , 9/* "STRING" */,-11 , 6/* "OR" */,-11 , 5/* "AND" */,-11 , 4/* "RIGHT_PARENTHESE" */,-11 ),
/* State 10 */ new Array( 10/* "WORD" */,12 , 9/* "STRING" */,13 ),
/* State 11 */ new Array( 19/* "$" */,-13 , 7/* "NOT" */,-13 , 3/* "LEFT_PARENTHESE" */,-13 , 8/* "COLUMN" */,-13 , 11/* "OPERATOR" */,-13 , 10/* "WORD" */,-13 , 9/* "STRING" */,-13 , 6/* "OR" */,-13 , 5/* "AND" */,-13 , 4/* "RIGHT_PARENTHESE" */,-13 ),
/* State 12 */ new Array( 19/* "$" */,-14 , 7/* "NOT" */,-14 , 3/* "LEFT_PARENTHESE" */,-14 , 8/* "COLUMN" */,-14 , 11/* "OPERATOR" */,-14 , 10/* "WORD" */,-14 , 9/* "STRING" */,-14 , 6/* "OR" */,-14 , 5/* "AND" */,-14 , 4/* "RIGHT_PARENTHESE" */,-14 ),
/* State 13 */ new Array( 19/* "$" */,-15 , 7/* "NOT" */,-15 , 3/* "LEFT_PARENTHESE" */,-15 , 8/* "COLUMN" */,-15 , 11/* "OPERATOR" */,-15 , 10/* "WORD" */,-15 , 9/* "STRING" */,-15 , 6/* "OR" */,-15 , 5/* "AND" */,-15 , 4/* "RIGHT_PARENTHESE" */,-15 ),
/* State 14 */ new Array( 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),
/* State 15 */ new Array( 19/* "$" */,-3 , 4/* "RIGHT_PARENTHESE" */,-3 ),
/* State 16 */ new Array( 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),
/* State 17 */ new Array( 19/* "$" */,-7 , 7/* "NOT" */,-7 , 3/* "LEFT_PARENTHESE" */,-7 , 8/* "COLUMN" */,-7 , 11/* "OPERATOR" */,-7 , 10/* "WORD" */,-7 , 9/* "STRING" */,-7 , 6/* "OR" */,-7 , 5/* "AND" */,-7 , 4/* "RIGHT_PARENTHESE" */,-7 ),
/* State 18 */ new Array( 4/* "RIGHT_PARENTHESE" */,23 ),
/* State 19 */ new Array( 19/* "$" */,-10 , 7/* "NOT" */,-10 , 3/* "LEFT_PARENTHESE" */,-10 , 8/* "COLUMN" */,-10 , 11/* "OPERATOR" */,-10 , 10/* "WORD" */,-10 , 9/* "STRING" */,-10 , 6/* "OR" */,-10 , 5/* "AND" */,-10 , 4/* "RIGHT_PARENTHESE" */,-10 ),
/* State 20 */ new Array( 19/* "$" */,-12 , 7/* "NOT" */,-12 , 3/* "LEFT_PARENTHESE" */,-12 , 8/* "COLUMN" */,-12 , 11/* "OPERATOR" */,-12 , 10/* "WORD" */,-12 , 9/* "STRING" */,-12 , 6/* "OR" */,-12 , 5/* "AND" */,-12 , 4/* "RIGHT_PARENTHESE" */,-12 ),
/* State 21 */ new Array( 19/* "$" */,-4 , 4/* "RIGHT_PARENTHESE" */,-4 ),
/* State 22 */ new Array( 19/* "$" */,-6 , 7/* "NOT" */,-6 , 3/* "LEFT_PARENTHESE" */,-6 , 8/* "COLUMN" */,-6 , 11/* "OPERATOR" */,-6 , 10/* "WORD" */,-6 , 9/* "STRING" */,-6 , 6/* "OR" */,-6 , 4/* "RIGHT_PARENTHESE" */,-6 ),
/* State 23 */ new Array( 19/* "$" */,-9 , 7/* "NOT" */,-9 , 3/* "LEFT_PARENTHESE" */,-9 , 8/* "COLUMN" */,-9 , 11/* "OPERATOR" */,-9 , 10/* "WORD" */,-9 , 9/* "STRING" */,-9 , 6/* "OR" */,-9 , 5/* "AND" */,-9 , 4/* "RIGHT_PARENTHESE" */,-9 )
);
/* Goto-Table */
var goto_tab = new Array(
/* State 0 */ new Array( 13/* begin */,1 , 12/* search_text */,2 , 14/* and_expression */,3 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),
/* State 1 */ new Array( ),
/* State 2 */ new Array( ),
/* State 3 */ new Array( 12/* search_text */,15 , 14/* and_expression */,3 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),
/* State 4 */ new Array( ),
/* State 5 */ new Array( 16/* expression */,17 , 17/* value */,9 , 18/* string */,11 ),
/* State 6 */ new Array( ),
/* State 7 */ new Array( 12/* search_text */,18 , 14/* and_expression */,3 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),
/* State 8 */ new Array( 16/* expression */,19 , 17/* value */,9 , 18/* string */,11 ),
/* State 9 */ new Array( ),
/* State 10 */ new Array( 18/* string */,20 ),
/* State 11 */ new Array( ),
/* State 12 */ new Array( ),
/* State 13 */ new Array( ),
/* State 14 */ new Array( 12/* search_text */,21 , 14/* and_expression */,3 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),
/* State 15 */ new Array( ),
/* State 16 */ new Array( 14/* and_expression */,22 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),
/* State 17 */ new Array( ),
/* State 18 */ new Array( ),
/* State 19 */ new Array( ),
/* State 20 */ new Array( ),
/* State 21 */ new Array( ),
/* State 22 */ new Array( ),
/* State 23 */ new Array( )
);
/* Symbol labels */
var labels = new Array(
"begin'" /* Non-terminal symbol */,
"WHITESPACE" /* Terminal symbol */,
"WHITESPACE" /* Terminal symbol */,
"LEFT_PARENTHESE" /* Terminal symbol */,
"RIGHT_PARENTHESE" /* Terminal symbol */,
"AND" /* Terminal symbol */,
"OR" /* Terminal symbol */,
"NOT" /* Terminal symbol */,
"COLUMN" /* Terminal symbol */,
"STRING" /* Terminal symbol */,
"WORD" /* Terminal symbol */,
"OPERATOR" /* Terminal symbol */,
"search_text" /* Non-terminal symbol */,
"begin" /* Non-terminal symbol */,
"and_expression" /* Non-terminal symbol */,
"boolean_expression" /* Non-terminal symbol */,
"expression" /* Non-terminal symbol */,
"value" /* Non-terminal symbol */,
"string" /* Non-terminal symbol */,
"$" /* Terminal symbol */
);
info.offset = 0;
info.src = src;
info.att = new String();
if( !err_off )
err_off = new Array();
if( !err_la )
err_la = new Array();
sstack.push( 0 );
vstack.push( 0 );
la = __lex( info );
while( true )
{
act = 25;
for( var i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )
{
if( act_tab[sstack[sstack.length-1]][i] == la )
{
act = act_tab[sstack[sstack.length-1]][i+1];
break;
}
}
if( _dbg_withtrace && sstack.length > 0 )
{
__dbg_print( "\nState " + sstack[sstack.length-1] + "\n" +
"\tLookahead: " + labels[la] + " (\"" + info.att + "\")\n" +
"\tAction: " + act + "\n" +
"\tSource: \"" + info.src.substr( info.offset, 30 ) + ( ( info.offset + 30 < info.src.length ) ?
"..." : "" ) + "\"\n" +
"\tStack: " + sstack.join() + "\n" +
"\tValue stack: " + vstack.join() + "\n" );
}
//Panic-mode: Try recovery when parse-error occurs!
if( act == 25 )
{
if( _dbg_withtrace )
__dbg_print( "Error detected: There is no reduce or shift on the symbol " + labels[la] );
err_cnt++;
err_off.push( info.offset - info.att.length );
err_la.push( new Array() );
for( var i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )
err_la[err_la.length-1].push( labels[act_tab[sstack[sstack.length-1]][i]] );
//Remember the original stack!
var rsstack = new Array();
var rvstack = new Array();
for( var i = 0; i < sstack.length; i++ )
{
rsstack[i] = sstack[i];
rvstack[i] = vstack[i];
}
while( act == 25 && la != 19 )
{
if( _dbg_withtrace )
__dbg_print( "\tError recovery\n" +
"Current lookahead: " + labels[la] + " (" + info.att + ")\n" +
"Action: " + act + "\n\n" );
if( la == -1 )
info.offset++;
while( act == 25 && sstack.length > 0 )
{
sstack.pop();
vstack.pop();
if( sstack.length == 0 )
break;
act = 25;
for( var i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )
{
if( act_tab[sstack[sstack.length-1]][i] == la )
{
act = act_tab[sstack[sstack.length-1]][i+1];
break;
}
}
}
if( act != 25 )
break;
for( var i = 0; i < rsstack.length; i++ )
{
sstack.push( rsstack[i] );
vstack.push( rvstack[i] );
}
la = __lex( info );
}
if( act == 25 )
{
if( _dbg_withtrace )
__dbg_print( "\tError recovery failed, terminating parse process..." );
break;
}
if( _dbg_withtrace )
__dbg_print( "\tError recovery succeeded, continuing" );
}
/*
if( act == 25 )
break;
*/
//Shift
if( act > 0 )
{
if( _dbg_withtrace )
__dbg_print( "Shifting symbol: " + labels[la] + " (" + info.att + ")" );
sstack.push( act );
vstack.push( info.att );
la = __lex( info );
if( _dbg_withtrace )
__dbg_print( "\tNew lookahead symbol: " + labels[la] + " (" + info.att + ")" );
}
//Reduce
else
{
act *= -1;
if( _dbg_withtrace )
__dbg_print( "Reducing by producution: " + act );
rval = void(0);
if( _dbg_withtrace )
__dbg_print( "\tPerforming semantic action..." );
switch( act )
{
case 0:
{
rval = vstack[ vstack.length - 1 ];
}
break;
case 1:
{
result = vstack[ vstack.length - 1 ];
}
break;
case 2:
{
rval = vstack[ vstack.length - 1 ];
}
break;
case 3:
{
rval = mkComplexQuery('OR',[vstack[ vstack.length - 2 ],vstack[ vstack.length - 1 ]]);
}
break;
case 4:
{
rval = mkComplexQuery('OR',[vstack[ vstack.length - 3 ],vstack[ vstack.length - 1 ]]);
}
break;
case 5:
{
rval = vstack[ vstack.length - 1 ] ;
}
break;
case 6:
{
rval = mkComplexQuery('AND',[vstack[ vstack.length - 3 ],vstack[ vstack.length - 1 ]]);
}
break;
case 7:
{
rval = mkNotQuery(vstack[ vstack.length - 1 ]);
}
break;
case 8:
{
rval = vstack[ vstack.length - 1 ];
}
break;
case 9:
{
rval = vstack[ vstack.length - 2 ];
}
break;
case 10:
{
simpleQuerySetId(vstack[ vstack.length - 1 ],vstack[ vstack.length - 2 ].split(':').slice(0,-1).join(':')); rval = vstack[ vstack.length - 1 ];
}
break;
case 11:
{
rval = vstack[ vstack.length - 1 ];
}
break;
case 12:
{
vstack[ vstack.length - 1 ].operator = vstack[ vstack.length - 2 ] ; rval = vstack[ vstack.length - 1 ];
}
break;
case 13:
{
rval = vstack[ vstack.length - 1 ];
}
break;
case 14:
{
rval = mkSimpleQuery('',vstack[ vstack.length - 1 ]);
}
break;
case 15:
{
rval = mkSimpleQuery('',vstack[ vstack.length - 1 ].split('"').slice(1,-1).join('"'));
}
break;
}
if( _dbg_withtrace )
__dbg_print( "\tPopping " + pop_tab[act][1] + " off the stack..." );
for( var i = 0; i < pop_tab[act][1]; i++ )
{
sstack.pop();
vstack.pop();
}
go = -1;
for( var i = 0; i < goto_tab[sstack[sstack.length-1]].length; i+=2 )
{
if( goto_tab[sstack[sstack.length-1]][i] == pop_tab[act][0] )
{
go = goto_tab[sstack[sstack.length-1]][i+1];
break;
}
}
if( act == 0 )
break;
if( _dbg_withtrace )
__dbg_print( "\tPushing non-terminal " + labels[ pop_tab[act][0] ] );
sstack.push( go );
vstack.push( rval );
}
if( _dbg_withtrace )
{
alert( _dbg_string );
_dbg_string = new String();
}
}
if( _dbg_withtrace )
{
__dbg_print( "\nParse complete." );
alert( _dbg_string );
}
return err_cnt;
}
var arrayExtend = function () {
var j,i,newlist=[],listoflists = arguments;
for (j=0; j<listoflists.length; ++j) {
for (i=0; i<listoflists[j].length; ++i) {
newlist.push(listoflists[j][i]);
}
}
return newlist;
};
var mkSimpleQuery = function (id,value,operator) {
return {type:'simple',operator:'=',id:id,value:value};
};
var mkNotQuery = function (query) {
if (query.operator === 'NOT') {
return query.query_list[0];
}
return {type:'complex',operator:'NOT',query_list:[query]};
};
var mkComplexQuery = function (operator,query_list) {
var i,query_list2 = [];
for (i=0; i<query_list.length; ++i) {
if (query_list[i].operator === operator) {
query_list2 = arrayExtend(query_list2,query_list[i].query_list);
} else {
query_list2.push(query_list[i]);
}
}
return {type:'complex',operator:operator,query_list:query_list2};
};
var simpleQuerySetId = function (query, id) {
var i;
if (query.type === 'complex') {
for (i = 0; i < query.query_list.length; ++i) {
simpleQuerySetId (query.query_list[i],id);
}
return true;
}
if (query.type === 'simple' && !query.id) {
query.id = id;
return true;
}
return false;
};
var error_offsets = [];
var error_lookaheads = [];
var error_count = 0;
var result;
if ( ( error_count = __parse( string, error_offsets, error_lookaheads ) ) > 0 ) {
var i;
for (i = 0; i < error_count; ++i) {
throw new Error ( "Parse error near \"" +
string.substr ( error_offsets[i] ) +
"\", expecting \"" +
error_lookaheads[i].join() + "\"" );
}
}
return result;
}
});
Object.defineProperty(scope.ComplexQueries,"serialize",{
configurable:false,enumerable:false,writable:false,value:function(query){
var str_list = [], i;
if (query.type === 'complex') {
str_list.push ( '(' );
for (i=0; i<query.query_list.length; ++i) {
str_list.push( scope.ComplexQueries.serialize(query.query_list[i]) );
str_list.push( query.operator );
}
str_list.length --;
str_list.push ( ')' );
return str_list.join(' ');
} else if (query.type === 'simple') {
return query.id + (query.id?': ':'') + query.operator + ' "' + query.value + '"';
}
return query;
}
});
Object.defineProperty(scope.ComplexQueries,"query",{
configurable:false,enumerable:false,writable:false,
value: function (query, object_list) {
var wildcard_character = typeof query.wildcard_character === 'string' ?
query.wildcard_character : '%',
operator_actions = {
'=': function (value1, value2) {
value1 = '' + value1;
return value1.match (convertToRegexp (
value2, wildcard_character
)) || false && true;
},
'!=': function (value1, value2) {
value1 = '' + value1;
return !(value1.match (convertToRegexp (
value2, wildcard_character
)));
},
'<': function (value1, value2) { return value1 < value2; },
'<=': function (value1, value2) { return value1 <= value2; },
'>': function (value1, value2) { return value1 > value2; },
'>=': function (value1, value2) { return value1 >= value2; },
'AND': function (item, query_list) {
var i;
for (i=0; i<query_list.length; ++i) {
if (! itemMatchesQuery (item, query_list[i])) {
return false;
}
}
return true;
},
'OR': function (item, query_list) {
var i;
for (i=0; i<query_list.length; ++i) {
if (itemMatchesQuery (item, query_list[i])) {
return true;
}
}
return false;
},
'NOT': function (item, query_list) {
return !itemMatchesQuery(item, query_list[0]);
}
},
convertToRegexp = function (string) {
return subString('^' + string.replace(
new RegExp(
'([\\{\\}\\(\\)\\^\\$\\&\\.\\*\\?\\\/\\+\\|\\[\\]\\-\\\\])'.
replace (wildcard_character?
'\\'+wildcard_character:undefined,''),
'g'
),
'\\$1'
) + '$',(wildcard_character||undefined), '.*');
},
subString = function (string, substring, newsubstring) {
var res = '', i = 0;
if (substring === undefined) {
return string;
}
while (1) {
var tmp = string.indexOf(substring,i);
if (tmp === -1) {
break;
}
for (; i < tmp; ++i) {
res += string[i];
}
res += newsubstring;
i += substring.length;
}
for (; i<string.length; ++i) {
res += string[i];
}
return res;
},
itemMatchesQuery = function (item, query_object) {
var i;
if (query_object.type === 'complex') {
return operator_actions[query_object.operator](
item, query_object.query_list
);
} else {
if (query_object.id) {
if (typeof item[query_object.id] !== 'undefined') {
return operator_actions[query_object.operator](
item[query_object.id], query_object.value
);
} else {
return false;
}
} else {
return true;
}
}
},
select = function (list, select_list) {
var i;
if (select_list.length === 0) {
return;
}
for (i=0; i<list.length; ++i) {
var list_value = {}, k;
for (k=0; k<select_list.length; ++k) {
list_value[select_list[k]] =
list[i][select_list[k]];
}
list[i] = list_value;
}
},
sortFunction = function (key, asc) {
if (asc === 'descending') {
return function (a,b) {
return a[key] < b[key] ? 1 : a[key] > b[key] ? -1 : 0;
};
}
return function (a,b) {
return a[key] > b[key] ? 1 : a[key] < b[key] ? -1 : 0;
};
},
mergeList = function (list, list_to_merge, index) {
var i,j;
for (i = index,j = 0; i < list_to_merge.length + index; ++i, ++j) {
list[i] = list_to_merge[j];
}
},
sort = function (list, sort_list) {
var i, tmp, key, asc, sortAndMerge = function() {
sort(tmp,sort_list.slice(1));
mergeList(list,tmp,i-tmp.length);
tmp = [list[i]];
};
if (list.length < 2) {
return;
}
if (sort_list.length === 0) {
return;
}
key = sort_list[0][0];
asc = sort_list[0][1];
list.sort (sortFunction (key,asc));
tmp = [list[0]];
for (i = 1; i < list.length; ++i) {
if (tmp[0][key] === list[i][key]) {
tmp.push(list[i]);
} else {
sortAndMerge();
}
}
sortAndMerge();
},
limit = function (list, limit_list) {
var i;
if (typeof limit_list[0] !== 'undefined') {
if (typeof limit_list[1] !== 'undefined') {
if (list.length > limit_list[1] + limit_list[0]) {
list.length = limit_list[1] + limit_list[0];
}
list.splice(0,limit_list[0]);
} else {
list.length = limit_list[0];
}
}
},
////////////////////////////////////////////////////////////
result_list = [], result_list_tmp = [], j;
object_list = object_list || [];
for (j=0; j<object_list.length; ++j) {
if ( itemMatchesQuery (
object_list[j], scope.ComplexQueries.parse (query.query)
)) {
result_list.push(object_list[j]);
}
}
if (query.filter) {
select(result_list,query.filter.select_list || []);
sort(result_list,query.filter.sort_on || []);
limit(result_list,query.filter.limit || []);
}
return result_list;
}
});
}(jIO));
......@@ -747,13 +747,7 @@ var RenderJs = (function () {
};
gadget_id = gadget_dom.attr("id");
gadget_connection_list = gadget_dom.attr("data-gadget-connection");
console.log("so, what do we have");
console.log(gadget_dom);
console.log(gadget_dom.attr('id'));
console.log(gadget_dom.attr("data-gadget-connection"));
console.log($.parseJSON(gadget_connection_list));
gadget_connection_list = $.parseJSON(gadget_connection_list);
$.each(gadget_connection_list, function (key, value) {
var source, source_gadget_id, source_method_id,
......
......@@ -24,6 +24,8 @@
"start_over":"Neue Berechnen",
"start_over_info":"Kriterien verändern und erneut berechnen",
"search_results":"Suchergebnisse",
"name":"Name",
"name_info":"Name des Anbieters",
"provider":"Anbieter",
"provider_info":"Name des Anbieters",
"availability":"Vefügbarkeit",
......@@ -86,5 +88,9 @@
"ram_info": "Info RAM",
"cpu_info": "Info CPU",
"archive_info": "Info Archive"
},
"results": {
"display_list":"Liste",
"display_graph":"Grafik"
}
}
......@@ -23,6 +23,8 @@
"info": "info",
"provider":"Provider",
"provider_info":"Name of the provider",
"name":"Name",
"name_info":"Name of the provider",
"availability":"Availability",
"availability_info":"Availability of Data.",
"data":"Data Loss",
......@@ -83,5 +85,9 @@
"ram_info": "Info RAM",
"cpu_info": "Info CPU",
"archive_info": "Info Archive"
},
"results": {
"display_list":"Show as list",
"display_graph":"Visualize"
}
}
......@@ -23,6 +23,8 @@
"info": "infos",
"provider":"Fournisseur",
"provider_info":"Nom du fournisseur",
"name": "Nom",
"name_info": "Nom du fournisseur",
"availability":"Disponibilité",
"availability_info":"Disponibilité des données.",
"data":"Perte de données",
......@@ -83,5 +85,9 @@
"ram_info": "Info RAM",
"cpu_info": "Info CPU",
"archive_info": "Info Stockage/Archives"
},
"results": {
"display_list":"Liste",
"display_graph":"Graphique"
}
}
......@@ -29,6 +29,7 @@
</div>
<div data-role="content">
<div id="index_wrapper" data-gadget="../gadgets/index_wrapper.html"></div>
<div data-gadget="" class="main-interactor"
data-gadget-connection="[
{&quot;source&quot;: &quot;index_header.translate&quot;, &quot;destination&quot;: &quot;index_wrapper.translate&quot;}
......
......@@ -7,7 +7,25 @@
</head>
<body class="splash">
<div data-role="page" id="results" >
<div id="results_header" data-gadget="../gadgets/header.html" data-gadget-property='{"dyn":{"title":"pages.titles.results","href":"popup_results_lang"}}'></div>
<div id="results_header" data-gadget="../gadgets/header.html"
data-gadget-property='{
"self": {
"h1": [
"data-i18n",
"pages.titles.results"
]
},
"translator": {
"a.setIcon": [
"href",
"#popup_results_lang"
],
"div.all_popups": [
"id",
"popup_results_lang"
]
}
}'></div>
<div data-role="content">
<div id="results_wrapper" data-gadget="../gadgets/results_wrapper.html"></div>
<div data-gadget="" class="main-interactor"
......
<!DOCTYPE html>
<html>
<head>
<!-- concat-ed individual templates -->
<!-- note: regex only works without linebreaks! -->
<title>jqm_templates</title>
</head>
<body>
<table>
<!-- tmp_result_row start --><tr id="tmp_result_row"><td><a href="#" title="tmp_title"><span class="image_wrapper"><img src="tmp_image_path" alt=""></span></a><h2 class="provider_name small">tmp_name</h2></td><td><span class="key super">tmp_name</span></td><td><span class="key super key_loss">tmp_data_loss</span></td><td><span class="key super key_availability">tmp_percentile&nbsp;%</span></td><td><span class="key super key_cost">tmp_price</span></td><td><a data-position-to="window" class="t scale-a" href="#provider_info_tmp_count" data-rel="popup" data-role="button" data-theme="c" data-icon="info" data-inline="true" data-i18n-target=".ui-btn-text" data-i18n="[title]gen.details_info;[html]gen.details"></a><div data-role="popup" id="provider_info_tmp_count" data-overlay-theme="a" data-theme="c" class="provider_popup ui-content ui-collapsible-popup"><div data-role="collapsible-set" data-type="horizontal" data-theme="f" data-content-theme="c"><div data-role="collapsible" data-collapsed-icon="arrow-d" data-expanded-icon="info" data-collapsed="false"><h1>Load</h1></div><div data-role="collapsible" data-collapsed-icon="pulse" data-expanded-icon="info"><h1>CPU</h1></div><div data-role="collapsible" data-collapsed="false" data-collapsed-icon="gear" data-expanded-icon="info"><h1>DTB</h1></div><div data-role="collapsible" data-collapsed-icon="chat" data-expanded-icon="info"><h1>Lang</h1></div><div data-role="collapsible" data-collapsed-icon="flash" data-expanded-icon="info"><h1>IO</h1></div></div></div></td></tr><!-- tmp_result_row end -->
<!---
<tr>
<td>
<a href="tmp_href" title="tmp_title">
<span class="image_wrapper"><img src="tmp_image_path" alt=""></span></a>
<h2 class="provider_name small">tmp_name</h2>
</td>
<td>
<span class="key super">tmp_name</span>
</td>
<td>
<span class="key super key_loss">tmp_data_loss</span>
</td>
<td>
<span class="key super key_availability">tmp_percentile&nbsp;%</span>
</td>
<td>
<span class="key super key_cost">tmp_price</span>
</td>
<td>
<a data-position-to="window" class="t scale-a" href="#provider_info" data-rel="popup" data-role="button" data-theme="c" data-icon="info" data-inline="true" data-i18n-target=".ui-btn-text" data-i18n="[title]gen.details_info;[html]gen.details"></a>
<div data-role="popup" id="provider_info_tmp_count" data-overlay-theme="a" data-theme="c" class="provider_popup ui-content ui-collapsible-popup">
<div data-role="collapsible-set" data-type="horizontal" data-theme="f" data-content-theme="c">
<div data-role="collapsible" data-collapsed-icon="arrow-d" data-expanded-icon="info" data-collapsed="false">
<h1>Load</h1>
</div>
<div data-role="collapsible" data-collapsed-icon="pulse" data-expanded-icon="info">
<h1>CPU</h1>
</div>
<div data-role="collapsible" data-collapsed="false" data-collapsed-icon="gear" data-expanded-icon="info">
<h1>DTB</h1>
</div>
<div data-role="collapsible" data-collapsed-icon="chat" data-expanded-icon="info">
<h1>Lang</h1>
</div>
<div data-role="collapsible" data-collapsed-icon="flash" data-expanded-icon="info">
<h1>IO</h1>
</div>
</div>
</div>
</td>
</tr>
--->
</table>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<!-- concat-ed individual templates -->
<!-- note: regex only works without linebreaks! -->
<title>jqm_templates</title>
</head>
<body>
<table>
<!-- tmp_result_row start --><tr id="tmp_result_row"><td><a href="#" title="tmp_title"><span class="image_wrapper"><img src="tmp_image_path" alt=""></span></a><h2 class="provider_name small">tmp_name</h2></td><td><span class="key super">tmp_name</span></td><td><span class="key super key_loss">tmp_data_loss</span></td><td><span class="key super key_availability">tmp_percentile&nbsp;%</span></td><td><span class="key super key_cost">tmp_price</span></td><td><a data-position-to="window" class="t scale-a" href="#provider_info_tmp_count" data-rel="popup" data-role="button" data-theme="c" data-icon="info" data-inline="true" data-i18n-target=".ui-btn-text" data-i18n="[title]gen.details_info;[html]gen.details"></a><div data-role="popup" id="provider_info_tmp_count" data-overlay-theme="a" data-theme="c" class="provider_popup ui-content ui-collapsible-popup"><div data-role="collapsible-set" data-type="horizontal" data-theme="f" data-content-theme="c"><div data-role="collapsible" data-collapsed-icon="arrow-d" data-expanded-icon="info" data-collapsed="false"><h1>Load</h1></div><div data-role="collapsible" data-collapsed-icon="pulse" data-expanded-icon="info"><h1>CPU</h1></div><div data-role="collapsible" data-collapsed="false" data-collapsed-icon="gear" data-expanded-icon="info"><h1>DTB</h1></div><div data-role="collapsible" data-collapsed-icon="chat" data-expanded-icon="info"><h1>Lang</h1></div><div data-role="collapsible" data-collapsed-icon="flash" data-expanded-icon="info"><h1>IO</h1></div></div></div></td></tr><!-- tmp_result_row end -->
<!---
<tr>
<td>
<a href="tmp_href" title="tmp_title">
<span class="image_wrapper"><img src="tmp_image_path" alt=""></span></a>
<h2 class="provider_name small">tmp_name</h2>
</td>
<td>
<span class="key super">tmp_name</span>
</td>
<td>
<span class="key super key_loss">tmp_data_loss</span>
</td>
<td>
<span class="key super key_availability">tmp_percentile&nbsp;%</span>
</td>
<td>
<span class="key super key_cost">tmp_price</span>
</td>
<td>
<a data-position-to="window" class="t scale-a" href="#provider_info_tmp_count" data-rel="popup" data-role="button" data-theme="c" data-icon="info" data-inline="true" data-i18n-target=".ui-btn-text" data-i18n="[title]gen.details_info;[html]gen.details"></a>
<div data-role="popup" id="provider_info_tmp_count" data-overlay-theme="a" data-theme="c" class="provider_popup ui-content ui-collapsible-popup">
<div data-role="collapsible-set" data-type="horizontal" data-theme="f" data-content-theme="c">
<div data-role="collapsible" data-collapsed-icon="arrow-d" data-expanded-icon="info" data-collapsed="false">
<h1>Load</h1>
</div>
<div data-role="collapsible" data-collapsed-icon="pulse" data-expanded-icon="info">
<h1>CPU</h1>
</div>
<div data-role="collapsible" data-collapsed="false" data-collapsed-icon="gear" data-expanded-icon="info">
<h1>DTB</h1>
</div>
<div data-role="collapsible" data-collapsed-icon="chat" data-expanded-icon="info">
<h1>Lang</h1>
</div>
<div data-role="collapsible" data-collapsed-icon="flash" data-expanded-icon="info">
<h1>IO</h1>
</div>
</div>
</div>
</td>
</tr>
--->
</table>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment