Skip to content

Commit f6ec494

Browse files
authored
Initial for WidgetSuggestedActionsPython.py
1 parent 9687085 commit f6ec494

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
def Get():
2+
# sql = Data.SQLContent
3+
template = Data.HTMLContent
4+
# params = { 'pid': }
5+
6+
pid = model.UserPeopleId
7+
if pid == 12255: # James's PID
8+
pid = 18428 # Jamin's PID because it's more useful for testing
9+
10+
Data.results = []
11+
12+
# For Shepherds: see those assigned to them
13+
shepCnt = q.QuerySqlInt("SELECT COUNT(*) FROM FamilyExtra WHERE Field = 'Shepherd PID' AND IntValue = {}".format(pid))
14+
if shepCnt > 0:
15+
Data.results.append(model.DynamicData({
16+
"path": "/PyScript/AssignShepherd?ShepId={}".format(pid),
17+
"fa": "users",
18+
"label": "My Flock"
19+
}))
20+
21+
22+
# Parish Emails
23+
parishes = [
24+
{
25+
"name": "Metro",
26+
"council": 191,
27+
"emailList": "f8285d98-15a5-46c7-8edf-35e06a8b2359"
28+
},
29+
{
30+
"name": "North",
31+
"council": 192,
32+
"emailList": "f7134258-ad0f-4739-83d7-42e417378f9a"
33+
},
34+
{
35+
"name": "West",
36+
"council": 193,
37+
"emailList": "6013e87d-c1de-4007-b54d-efc5e37c4e05"
38+
},
39+
{
40+
"name": "Brandywine",
41+
"council": 194,
42+
"emailList": "b9e1b009-a154-4c93-ab9d-275c43f9c7d6"
43+
},
44+
{
45+
"name": "Jersey",
46+
"council": 195,
47+
"emailList": "b7750b1b-13c4-4343-8380-c0bdcf4911cd"
48+
},
49+
{
50+
"name": "Non-Res",
51+
"council": 196
52+
}
53+
]
54+
for p in parishes:
55+
if model.InOrg(pid, p['council']):
56+
if 'emailList' in p:
57+
Data.results.append(model.DynamicData({
58+
"path": "/Email/{}".format(p['emailList']),
59+
"fa": "envelope",
60+
"label": "Send {} Parish Email".format(p['name'])
61+
}))
62+
63+
64+
65+
66+
# How-To Videos
67+
Data.results.append(model.DynamicData({
68+
"path": "https://www.tenth.org/mytenth",
69+
"fa": "video-camera",
70+
"label": "How-To Videos"
71+
}))
72+
73+
74+
print model.RenderTemplate(template)
75+
76+
Get()

0 commit comments

Comments
 (0)