-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
178 lines (140 loc) · 7.63 KB
/
Copy pathREADME
File metadata and controls
178 lines (140 loc) · 7.63 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
Groups Module - Readme
========================
Version 0.2, alpha 2004/05/27
-- lehdem correction in:
B 2) javascript
B 3) addGroup ( }s missing)
B 7) register_globals
Summary:
The Groups module allows user to assign contacts to a group or multiple groups. As a stand-alone module, its pretty useless.
However, this module can be used as a launch point to build other modules using group lists.
For example, combined with a newsletter module to create mailing lists. I also implemented this into contacts/index.php
so I have a pull down menu that only returns contacts for a certain group (see sect C, Integrate into contacts/index.php)
A) Stand Alone Module
1) Download and unpack Groups module
2) Place groups folder into dotproject /modules folder
3) Add "groups" to permissions by making the following changes to /modules/admin/vw_usr_perms.php:
Line 11:
replace:
> 'forums' => 'forum_name'
with:
> 'forums' => 'forum_name',
> 'groups'=>'group_name'
Line 30:
replace:
> fm.forum_id, fm.forum_name,
with:
> fm.forum_id, fm.forum_name,
> g.group_id, g.group_name,
Line 39 (same sql statement as above):
replace:
> LEFT JOIN forums fm ON fm.forum_id = p.permission_item and p.permission_grant_on = 'forums'
with:
> LEFT JOIN forums fm ON fm.forum_id = p.permission_item and p.permission_grant_on = 'forums'
> LEFT JOIN groups g ON g.group_id = p.permission_item and p.permission_grant_on = 'groups'
Line 111:
replace:
> tables['forums'] = 'forums';
with:
> tables['forums'] = 'forums';
> tables['groups'] = 'groups';
4) Add the following case for groups around line 93 in /modules/public/selector.php (after case 'users' & before default:):
case 'groups':
$title = 'Groups';
$select = 'group_id,group_name';
$order = 'group_name';
break;
5) Login to dotproject as Admin and Install, Activate and make Visible "Groups" module
B) Integrate into Contacts add/edit
This will allow you to add a contact to group(s) from the addedit contact form. I should've just included the revised contacts module files, but I made a bunch of other changes to contacts that aren't affiliated with the groups module.
My bad -- should've created different versions.
1) /modules/contacts/addedit.php - Insert following lines before "//setup the title block"
// Pull groups for the parent groups list
$sql="
SELECT group_id, group_name
FROM groups
ORDER BY group_name ";
$allGroups = db_loadHashList( $sql );
// Pull groups for this contact
$sql = "
SELECT g.group_id, g.group_name
FROM groups g, groups_contacts gc
WHERE gc.contact_id = $contact_id
AND g.group_id = gc.group_id
";
$contactGroups = db_loadHashList( $sql );
2) /modules/contacts/addedit.php - insert following lines in javascript function submitIt() in form.submit() else block
var fl = form.contact_groups.options.length-1;
form.hcg.value = "";
for (fl; fl > -1; fl--){
form.hcg.value = "," + form.hcg.value +","+ form.contact_groups.options[fl].value
}
3) /modules/contacts/addedit.php - insert following javascript functions
function addGroup() {
var form = document.changecontact;
var at = form.all_groups.length -1;
var td = form.contact_groups.length -1;
var groups = "x";
//build array of groups
for (td; td > -1; td--) {
groups = groups + "," + form.contact_groups.options[td].value + ","
}
//Pull selected resources and add them to list
for (at; at > -1; at--) {
if (form.all_groups.options[at].selected && groups.indexOf( "," + form.all_groups.options[at].value + "," ) == -1) {
t = form.contact_groups.length
opt = new Option( form.all_groups.options[at].text, form.all_groups.options[at].value);
form.contact_groups.options[t] = opt;
}
}
}function removeGroup() {
var form = document.changecontact;
td = form.contact_groups.length -1;
for (td; td > -1; td--) {
if (form.contact_groups.options[td].selected) {
form.contact_groups.options[td] = null;
}
}
}
4) /modules/contacts/addedit.php - Insert above "contact notes" <tr></tr> block in html (or wherever you prefer to have this in the layout)
<tr>
<td>
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td><?php echo $AppUI->_( 'All Groups' );?></td>
<td><?php echo $AppUI->_( 'This Contact\'s Groups' );?></td>
</tr>
<tr>
<td>
<?php echo arraySelect( $allGroups, 'all_groups', 'style="width:180px" size="10" style="font-size:9pt;" multiple="multiple"', null ); ?>
</td>
<td>
<?php echo arraySelect( $contactGroups, 'contact_groups', 'style="width:180px" size="10" style="font-size:9pt;" multiple="multiple"', null ); ?>
</td>
</tr>
<tr>
<td align="right"><input type="button" class="button" value=">" onClick="addGroup()" /></td>
<td align="left"><input type="button" class="button" value="<" onClick="removeGroup()" /></td>
</tr>
5) /modules/contacts/addedit.php - insert before </form>
<input type="hidden" name="hcg" />
6) /modules/contacts/contacts.class.php - insert after function check()
function updateGroups( $cslist ) {
// delete all current entries
$sql = "DELETE FROM groups_contacts WHERE contact_id = $this->contact_id";
db_exec( $sql );
// process dependencies
$tarr = explode( ",", $cslist );
foreach ($tarr as $group_id) {
if (intval( $group_id ) > 0) {
$sql = "INSERT into groups_contacts (contact_id, group_id) VALUES ($this->contact_id, $group_id)";
db_exec($sql);
}
}
}
7) /modules/contacts/contact_aed.php - insert before $AppUIredirect();
if(isset($_POST['hcg'])) {
$obj->updateGroups( $_POST['hcg'] );
}
C) Integrate into /modules/contacts/index.php
This file is included in the package. Just diff what you currently have to see the changes.