Browse code

minor changes

bfadmin-master authored on26/04/2016 22:55:13
Showing8 changed files
... ...
@@ -72,16 +72,6 @@ def main():
72 72
 		"build": "build",
73 73
 	}
74 74
 	
75
-	parts_data = [
76
-		os.path.join(dirs["source"],"data","phonology_and_orthography.json"),
77
-		os.path.join(dirs["source"],"data","personal_pronouns.json"),
78
-		os.path.join(dirs["source"],"data","word_functions.json"),
79
-		os.path.join(dirs["source"],"data","timeforms.json"),
80
-		os.path.join(dirs["source"],"data","adpositions.json"),
81
-		os.path.join(dirs["source"],"data","correlatives.json"),
82
-		os.path.join(dirs["source"],"data","x.json"),
83
-	]
84
-	
85 75
 	parts_logic_server = [
86 76
 		os.path.join(dirs["source"],"logic","server","misc.php"),
87 77
 		os.path.join(dirs["source"],"logic","server","data.php"),
... ...
@@ -90,13 +80,6 @@ def main():
90 80
 		os.path.join(dirs["source"],"logic","server","sql.php"),
91 81
 	]
92 82
 	
93
-	parts_logic_client = [
94
-		os.path.join(dirs["source"],"logic","client","tools.js"),
95
-		os.path.join(dirs["source"],"logic","client","table.js"),
96
-		os.path.join(dirs["source"],"logic","client","toc.js"),
97
-		os.path.join(dirs["source"],"logic","client","main.js"),
98
-	]
99
-	
100 83
 	parts_structure = [
101 84
 		os.path.join(dirs["source"],"structure","draft.html.php"),
102 85
 		os.path.join(dirs["source"],"structure","meta.html.php"),
... ...
@@ -123,7 +106,25 @@ def main():
123 106
 		os.path.join(dirs["source"],"structure","dictionary.html.php"),
124 107
 	]
125 108
 	
109
+	parts_data = [
110
+		os.path.join(dirs["source"],"data","phonology_and_orthography.json"),
111
+		os.path.join(dirs["source"],"data","personal_pronouns.json"),
112
+		os.path.join(dirs["source"],"data","word_functions.json"),
113
+		os.path.join(dirs["source"],"data","timeforms.json"),
114
+		os.path.join(dirs["source"],"data","adpositions.json"),
115
+		os.path.join(dirs["source"],"data","correlatives.json"),
116
+		os.path.join(dirs["source"],"data","x.json"),
117
+	]
118
+	
119
+	parts_logic_client = [
120
+		os.path.join(dirs["source"],"logic","client","tools.js"),
121
+		os.path.join(dirs["source"],"logic","client","table.js"),
122
+		os.path.join(dirs["source"],"logic","client","toc.js"),
123
+		os.path.join(dirs["source"],"logic","client","main.js"),
124
+	]
125
+	
126 126
 	parts_style = [
127
+		os.path.join(dirs["source"],"style","functions.less"),
127 128
 		os.path.join(dirs["source"],"style","theme.less"),
128 129
 		os.path.join(dirs["source"],"style","common.less"),
129 130
 		os.path.join(dirs["source"],"style","concrete.less"),
... ...
@@ -29,10 +29,10 @@ build/favicon.png: source/media/folksprak_16x16.png
29 29
 	@ mkdir --parents build
30 30
 	@ cp --recursive source/media/folksprak_16x16.png build/favicon.png
31 31
 
32
-build/draft.css: source/style/theme.less source/style/common.less source/style/concrete.less
32
+build/draft.css: source/style/functions.less source/style/theme.less source/style/common.less source/style/concrete.less
33 33
 	@ echo -e '-- compiling style ...'
34 34
 	@ mkdir --parents temp
35
-	@ cat source/style/theme.less source/style/common.less source/style/concrete.less > temp/draft.less
35
+	@ cat source/style/functions.less source/style/theme.less source/style/common.less source/style/concrete.less > temp/draft.less
36 36
 	@ mkdir --parents build
37 37
 	@ lessc temp/draft.less > build/draft.css
38 38
 
... ...
@@ -236,7 +236,8 @@
236 236
 		    "type_id":"demonstrative_far",
237 237
 		    "language":"en",
238 238
 		    "words":[
239
-
239
+				"that person",
240
+				"that one"
240 241
 		    ]
241 242
 		},
242 243
 		{
... ...
@@ -252,7 +253,8 @@
252 253
 		    "type_id":"demonstrative_near",
253 254
 		    "language":"en",
254 255
 		    "words":[
255
-
256
+				"this person",
257
+				"this one"
256 258
 		    ]
257 259
 		},
258 260
 		{
... ...
@@ -269,7 +271,8 @@
269 271
 		    "type_id":"universal",
270 272
 		    "language":"en",
271 273
 		    "words":[
272
-		        "everyone"
274
+		        "everyone",
275
+		        "everybody"
273 276
 		    ]
274 277
 		},
275 278
 		{
... ...
@@ -286,7 +289,8 @@
286 289
 		    "type_id":"undefined",
287 290
 		    "language":"en",
288 291
 		    "words":[
289
-		        "someone"
292
+		        "someone",
293
+		        "somebody"
290 294
 		    ]
291 295
 		},
292 296
 		{
... ...
@@ -303,7 +307,8 @@
303 307
 		    "type_id":"negative",
304 308
 		    "language":"en",
305 309
 		    "words":[
306
-		        "no one"
310
+		        "no one",
311
+		        "nobody"
307 312
 		    ]
308 313
 		},
309 314
 		{
... ...
@@ -404,7 +409,8 @@
404 409
 		    "type_id":"undefined",
405 410
 		    "language":"en",
406 411
 		    "words":[
407
-		        "something"
412
+		        "something",
413
+		        "anything"
408 414
 		    ]
409 415
 		},
410 416
 		{
... ...
@@ -438,7 +444,7 @@
438 444
 		    "type_id":"interrogative",
439 445
 		    "language":"en",
440 446
 		    "words":[
441
-
447
+				"whose"
442 448
 		    ]
443 449
 		},
444 450
 		{
... ...
@@ -455,7 +461,7 @@
455 461
 		    "type_id":"relative",
456 462
 		    "language":"en",
457 463
 		    "words":[
458
-
464
+				"whose"
459 465
 		    ]
460 466
 		},
461 467
 		{
... ...
@@ -471,7 +477,7 @@
471 477
 		    "type_id":"demonstrative_far",
472 478
 		    "language":"en",
473 479
 		    "words":[
474
-
480
+		    	"that one's"
475 481
 		    ]
476 482
 		},
477 483
 		{
... ...
@@ -487,7 +493,7 @@
487 493
 		    "type_id":"demonstrative_near",
488 494
 		    "language":"en",
489 495
 		    "words":[
490
-
496
+		    	"this one's"
491 497
 		    ]
492 498
 		},
493 499
 		{
... ...
@@ -504,7 +510,7 @@
504 510
 		    "type_id":"universal",
505 511
 		    "language":"en",
506 512
 		    "words":[
507
-
513
+		    	"everyone's"
508 514
 		    ]
509 515
 		},
510 516
 		{
... ...
@@ -521,7 +527,7 @@
521 527
 		    "type_id":"undefined",
522 528
 		    "language":"en",
523 529
 		    "words":[
524
-
530
+		    	"someone's"
525 531
 		    ]
526 532
 		},
527 533
 		{
... ...
@@ -538,7 +544,7 @@
538 544
 		    "type_id":"negative",
539 545
 		    "language":"en",
540 546
 		    "words":[
541
-
547
+		    	"no one's"
542 548
 		    ]
543 549
 		},
544 550
 		{
... ...
@@ -640,7 +646,9 @@
640 646
 		    "type_id":"undefined",
641 647
 		    "language":"en",
642 648
 		    "words":[
643
-		        "sometimes"
649
+		        "sometimes",
650
+		        "anytime",
651
+		        "ever"
644 652
 		    ]
645 653
 		},
646 654
 		{
... ...
@@ -36,17 +36,20 @@
36 36
 		}
37 37
 	}
38 38
 	
39
-	function sql_rename($table_source, $column_from, $column_to)
39
+	function sql_project($table_source, $columns)
40 40
 	{
41 41
 		return (
42 42
 			array_map
43 43
 			(
44
-				function ($row_in) use (&$column_from,&$column_to)
44
+				function ($row_in) use (&$columns)
45 45
 				{
46 46
 					$row_out = [];
47
-					foreach ($row_in as $column => $value)
47
+					foreach ($row_in as $key_in => $value_in)
48 48
 					{
49
-						$row_out[($column == $column_from) ? $column_to : $column] = $row_in[$column];
49
+						if (array_search($key_in, $columns) !== false)
50
+						{
51
+							$row_out[$key_in] = $value_in;
52
+						}
50 53
 					}
51 54
 					return $row_out;
52 55
 				},
... ...
@@ -55,7 +58,7 @@
55 58
 		);
56 59
 	}
57 60
 	
58
-	function sql_project($table_source, $columns)
61
+	function sql_delete($table_source, $columns)
59 62
 	{
60 63
 		return (
61 64
 			array_map
... ...
@@ -63,14 +66,13 @@
63 66
 				function ($row_in) use (&$columns)
64 67
 				{
65 68
 					$row_out = [];
66
-					array_map
67
-					(
68
-						function ($column) use (&$columns,&$row_in,&$row_out)
69
+					foreach ($row_in as $key_in => $value_in)
70
+					{
71
+						if (array_search($key_in, $columns) === false)
69 72
 						{
70
-							$row_out[$column] = $row_in[$column];
71
-						},
72
-						$columns
73
-					);
73
+							$row_out[$key_in] = $value_in;
74
+						}
75
+					}
74 76
 					return $row_out;
75 77
 				},
76 78
 				$table_source
... ...
@@ -78,15 +80,37 @@
78 80
 		);
79 81
 	}
80 82
 	
81
-	function sql_add($table_source, $column, $assigner)
83
+	function sql_add($table_source, $columns, $assigners = [])
82 84
 	{
83 85
 		return (
84 86
 			array_map
85 87
 			(
86
-				function ($row_in) use (&$column,&$assigner)
88
+				function ($row_in) use (&$columns, &$assigners)
87 89
 				{
88 90
 					$row_out = $row_in;
89
-					$row_out[$column] = $assigner($row_in);
91
+					foreach ($columns as $column)
92
+					{
93
+						$row_out[$column] = (array_key_exists($column, $assigners) ? $assigners[$column]($row_in) : null);
94
+					}
95
+					return $row_out;
96
+				},
97
+				$table_source
98
+			)
99
+		);
100
+	}
101
+	
102
+	function sql_rename($table_source, $column_from, $column_to)
103
+	{
104
+		return (
105
+			array_map
106
+			(
107
+				function ($row_in) use (&$column_from,&$column_to)
108
+				{
109
+					$row_out = [];
110
+					foreach ($row_in as $column => $value)
111
+					{
112
+						$row_out[($column == $column_from) ? $column_to : $column] = $row_in[$column];
113
+					}
90 114
 					return $row_out;
91 115
 				},
92 116
 				$table_source
... ...
@@ -100,79 +100,30 @@
100 100
 			global $configuration;
101 101
 			$database = read_json("source/data/x.json");
102 102
 			$data = $database["words"];
103
-			$data = (
104
-				/*
105
-				sql_project
106
-				(
107
-				 */
108
-					sql_select
109
-					(
110
-						sql_rename
111
-						(
112
-							sql_cross
113
-							(
114
-								$data,
115
-								$database["domains"]
116
-							),
117
-							"name",
118
-							"domain_name"
119
-						),
120
-						function ($row) {return ($row["id"] == $row["domain_id"]);}
121
-					)/*,
122
-					["domain_id", "name", "type_id", "language", "words"]
123
-				)
124
-				 */
125
-			);
126
-			$data = (
127
-				/*
128
-				sql_project
129
-				(
130
-				 */
131
-					sql_select
132
-					(
133
-						sql_rename
134
-						(
135
-							sql_cross
136
-							(
137
-								$data,
138
-								$database["types"]
139
-							),
140
-							"name",
141
-							"type_name"
142
-						),
143
-						function ($row) {return ($row["id"] == $row["type_id"]);}
144
-					)/*,
145
-					["domain_name", "name", "language", "words"]
146
-				)
147
-				 */
148
-			);
149
-			$data = (
150
-				sql_select
151
-				(
152
-					$data,
153
-					function ($row) {return ($row["language"] == "fs");}
154
-				)
155
-			);
156
-			$data = (
157
-				sql_add
158
-				(
159
-					$data,
160
-					"type_name/words",
161
-					function ($row)
162
-					{
163
-						return ["key" => $row["type_id"], "value" => $row["words"]];
164
-					}
165
-				)
166
-			);
167
-			$data = (
168
-				sql_project
169
-				(
170
-					$data,
171
-					["domain_name", "type_name/words"]
172
-				)
173
-			);
174
-			$data = (
175
-				sql_group
103
+			
104
+			// get domain names
105
+			{
106
+				$data = sql_cross($data, $database["domains"]);
107
+				$data = sql_rename($data, "name", "domain_name");
108
+				$data = sql_select($data, function ($row) {return ($row["id"] == $row["domain_id"]);});
109
+				$data = sql_delete($data, ["id"]);
110
+			}
111
+			
112
+			// get type names
113
+			{
114
+				$data = sql_cross($data, $database["types"]);
115
+				$data = sql_rename($data, "name", "type_name");
116
+				$data = sql_select($data, function ($row) {return ($row["id"] == $row["type_id"]);});
117
+				$data = sql_delete($data, ["id"]);
118
+			}
119
+			
120
+			// transform
121
+			{
122
+				$data = sql_select($data, function ($row) {global $configuration; return (($row["language"] == "fs") or ($row["language"] == $configuration["target"]));});
123
+				// $data = sql_group($data, "language");
124
+				$data = sql_add($data, ["type_name/words"], ["type_name/words" => function ($row) {return ["key" => $row["type_id"], "value" => [$row["language"] => $row["words"]]];}]);
125
+				$data = sql_project($data, ["domain_name", "type_name/words"]);
126
+				$data = sql_group
176 127
 				(
177 128
 					$data,
178 129
 					"domain_name",
... ...
@@ -180,25 +131,27 @@
180 131
 						"type_name/words" => function ($args)
181 132
 						{
182 133
 							$output = [];
183
-							array_map
184
-							(
185
-								function ($arg) use (&$output)
134
+							foreach ($args as $arg)
135
+							{
136
+								if (! array_key_exists($arg["key"], $output)) $output[$arg["key"]] = [];
137
+								foreach ($arg["value"] as $key => $value)
186 138
 								{
187
-									$output[$arg["key"]] = $arg["value"];
188
-								},
189
-								$args
190
-							);
139
+									$output[$arg["key"]][$key] = $value;
140
+								}
141
+							}
191 142
 							return $output;
192 143
 						},
193 144
 					]
194
-				)
195
-			);
145
+				);
146
+			}
147
+			
196 148
 			$table = new class_table
197 149
 			(
198 150
 				array_merge
199 151
 				(
200 152
 					[
201 153
 						new class_column("Domain", function ($row) {return $row["domain_name"];}),
154
+						// new class_column("type_name/words", function ($row) {return $row["type_name/words"];}, function ($value) {print_r($value);}),
202 155
 					],
203 156
 					array_map
204 157
 					(
... ...
@@ -208,12 +161,16 @@
208 161
 								new class_column
209 162
 								(
210 163
 									("Type: " . $type["name"]),
211
-									function ($row) use (&$type) {return $row["type_name/words"][$type["id"]];},
212
-									function ($value) {return _baz($value, "word", "fs");}
164
+									function ($row) use (&$type)
165
+									{
166
+										global $configuration;
167
+										return ["original" => $row["type_name/words"][$type["id"]]["fs"], "translated" => $row["type_name/words"][$type["id"]][$configuration["target"]]];
168
+									},
169
+									_bar("word")
213 170
 								)
214 171
 							);
215 172
 						},
216
-						$database["types"]
173
+						array_filter($database["types"], function ($type) {return ($type["id"] != "relative");})
217 174
 					)
218 175
 				),
219 176
 				$data
... ...
@@ -1,14 +1,17 @@
1 1
 table.datatable
2 2
 {
3 3
 	border-collapse: collapse;
4
+	/*
4 5
 	box-shadow: 4px 4px 4px black;
6
+	 */
5 7
 	
6 8
 	& tr
7 9
 	{
8 10
 		& > th,
9 11
 		& > td
10 12
 		{
11
-			border: 1px solid hsv(hsvhue(@color-fg), hsvsaturation(@color-fg), (0.5 * hsvvalue(@color-fg)) + (0.5 * hsvvalue(@color-bg)));
13
+			.interpolate(hsvvalue(@color-fg), hsvvalue(@color-bg), 0.5);
14
+			border: 1px solid hsv(hsvhue(@color-fg), hsvsaturation(@color-fg), @result_interpolate);
12 15
 			/*
13 16
 			border: 1px solid @color-bg;
14 17
 			 */
15 18
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+.interpolate(@x, @y, @t)
2
+{
3
+	@result_interpolate: (((1-@t) * @x) + (@t * @y));
4
+}
5
+
... ...
@@ -1,10 +1,10 @@
1
+/*
1 2
 @color-bg: hsv(120,  0%,100.0%);
2 3
 @color-fg: hsv(120,  0%,  0.0%);
4
+ */
3 5
 
4
-/*
5 6
 @color-bg: hsv(120,  0%, 12.5%);
6 7
 @color-fg: hsv(120,  0%, 75.0%);
7
- */
8 8
 
9 9
 @color-x1: hsv(120, 50%, 50.0%);
10 10
 @color-x2: hsv(120, 50%, 50.0%);