-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostproc.sh
executable file
·74 lines (64 loc) · 2.72 KB
/
postproc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
cd module
# Make local records work with the search feature
string="String searchQuery = \"SELECT uuid, response \"+
\" FROM latestNonDeletedArchEntFormattedIdentifiers \"+
\" WHERE uuid in (SELECT uuid \"+
\" FROM latestNonDeletedArchEntIdentifiers \"+
\" WHERE measure LIKE '\"+term+\"'||'%' \"+
\" AND ( aenttypename LIKE '\"+type+\"' OR '' = '\"+type+\"' ) \"+
\" ) \"+
\" ORDER BY response \"+
\" LIMIT ? \"+
\"OFFSET ? \";"
replacement="String searchQuery = \" SELECT uuid, response \"+
\" FROM localRecord \"+
\" WHERE response LIKE '%'||'\"+term+\"'||'%' \"+
\"ORDER BY uuid DESC \"+
\" LIMIT ? \"+
\" OFFSET ? \";"
perl -0777 -i.original -pe "s/\\Q$string/$replacement/igs" ui_logic.bsh
# Make local records work with duplication
string="onSave(autosaveUuid, autosaveNewRecord) {
setUuid(tabgroup, autosaveUuid);
}"
replacement="onSave(autosaveUuid, autosaveNewRecord) {
setUuid(tabgroup, autosaveUuid);
saveFieldCallback();
}"
perl -0777 -i.original -pe "s/\\Q$string/$replacement/igs" ui_logic.bsh
# Make local records work with deletion
string="reallyDeleteField(){
String tabgroup = \"Field\";"
replacement="reallyDeleteField(){
String tabgroup = \"Field\";
deleteFieldCallback();"
perl -0777 -i.original -pe "s/\\Q$string/$replacement/igs" ui_logic.bsh
# Make module unpack geometry into globals on Field load
string="loadFieldFrom(String uuid) {
String tabgroup = \"Field\";
setUuid(tabgroup, uuid);
if (isNull(uuid)) return;
showTabGroup(tabgroup, uuid);
}"
replacement="loadFieldFrom(String uuid) {
String tabgroup = \"Field\";
setUuid(tabgroup, uuid);
if (isNull(uuid)) return;
FetchCallback onLoadField = new FetchCallback() {
onFetch(entity) {
geoList = entity.getGeometryList();
unpackFieldGeometry(geoList);
}
};
showTabGroup(tabgroup, uuid, onLoadField);
}"
perl -0777 -i.original -pe "s/\\Q$string/$replacement/igs" ui_logic.bsh
# Make module save geometry correctly
string="List geometry = null;"
replacement="List geometry = packFieldGeometry();"
perl -0777 -i.original -pe "s/\\Q$string/$replacement/igs" ui_logic.bsh
string="duplicateTabGroup(tabgroup, null"
replacement="duplicateTabGroup(tabgroup, packFieldGeometry()"
perl -0777 -i.original -pe "s/\\Q$string/$replacement/igs" ui_logic.bsh
rm ui_logic.bsh.original