edit.php 23 KB
Newer Older
Martyn Smith's avatar
Martyn Smith committed
1
2
3
4
5
<?php
/**
 *
 * @package    mahara
 * @subpackage core
6
 * @author     Catalyst IT Ltd
7
8
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
Martyn Smith's avatar
Martyn Smith committed
9
10
11
12
 *
 */

define('INTERNAL', 1);
13
define('MENUITEM', 'groups/groupsiown');
14
require(dirname(dirname(__FILE__)) . '/init.php');
Martyn Smith's avatar
Martyn Smith committed
15
require_once('pieforms/pieform.php');
16
require_once('group.php');
17
require_once(get_config('libroot') . 'antispam.php');
18
require_once('embeddedimage.php');
Martyn Smith's avatar
Martyn Smith committed
19

20
21
22
if ($id = param_integer('id', null)) {
    define('TITLE', get_string('editgroup', 'group'));
    define('GROUP', $id);
Martyn Smith's avatar
Martyn Smith committed
23

24
    if (!group_user_access($id)) {
25
26
27
        $SESSION->add_error_msg(get_string('canteditdontown', 'group'));
        redirect('/group/mygroups.php');
    }
28
29
30
31
32
33
34
35

    $group_data = group_get_groups_for_editing(array($id));

    if (count($group_data) != 1) {
        throw new GroupNotFoundException(get_string('groupnotfound', 'group', $id));
    }

    $group_data = $group_data[0];
36
37
38
39

    // Fix dates to unix timestamps instead of formatted timestamps.
    $group_data->editwindowstart = isset($group_data->editwindowstart) ? strtotime($group_data->editwindowstart) : null;
    $group_data->editwindowend = isset($group_data->editwindowend) ? strtotime($group_data->editwindowend) : null;
40
41
42
43
44
45
46
47
48
49
50
51
52
}
else {
    define('TITLE', get_string('creategroup', 'group'));

    if (!group_can_create_groups()) {
        throw new AccessDeniedException(get_string('accessdenied', 'error'));
    }

    $group_data = (object) array(
        'id'             => null,
        'name'           => null,
        'description'    => null,
        'grouptype'      => 'standard',
53
54
        'open'           => 1,
        'controlled'     => 0,
55
56
57
        'category'       => 0,
        'public'         => 0,
        'usersautoadded' => 0,
58
        'viewnotify'     => GROUP_ROLES_ALL,
59
        'submittableto'  => 0,
60
        'allowarchives'  => 0,
61
        'editroles'      => 'all',
62
        'hidden'         => 0,
63
        'hidemembers'    => 0,
64
        'hidemembersfrommembers' => 0,
65
        'groupparticipationreports' => 0,
66
67
        'invitefriends'  => 0,
        'suggestfriends' => 0,
68
        'urlid'          => null,
69
        'editwindowstart' => null,
70
        'editwindowend'  => null,
71
72
        'sendnow'        => 0,
        'feedbacknotify' => GROUP_ROLES_ALL,
73
    );
Martyn Smith's avatar
Martyn Smith committed
74
}
75

76
77
78
79
80
81
$form = array(
    'name'       => 'editgroup',
    'plugintype' => 'core',
    'pluginname' => 'groups',
    'elements'   => array(
        'name' => array(
Martyn Smith's avatar
Martyn Smith committed
82
            'type'         => 'text',
83
            'title'        => get_string('groupname', 'group'),
Penny Leach's avatar
Penny Leach committed
84
            'rules'        => array( 'required' => true, 'maxlength' => 128 ),
85
86
87
            'defaultvalue' => $group_data->name,
        ),
        'description' => array(
Martyn Smith's avatar
Martyn Smith committed
88
            'type'         => 'wysiwyg',
89
            'title'        => get_string('groupdescription', 'group'),
90
            'rules'        => array('maxlength' => 65536),
Martyn Smith's avatar
Martyn Smith committed
91
            'rows'         => 10,
92
            'cols'         => 55,
93
94
            'defaultvalue' => $group_data->description,
        ),
95
96
97
98
99
100
101
102
103
        'urlid' => array(
            'type'         => 'text',
            'title'        => get_string('groupurl', 'group'),
            'prehtml'      => '<span class="description">' . get_config('wwwroot') . get_config('cleanurlgroupdefault') . '/</span> ',
            'description'  => get_string('groupurldescription', 'group') . ' ' . get_string('cleanurlallowedcharacters'),
            'rules'        => array('maxlength' => 30, 'regex' => get_config('cleanurlvalidate')),
            'defaultvalue' => $group_data->urlid,
            'ignore'       => !$id || !get_config('cleanurls'),
        ),
104
105
106
107
        'settings' => array(
            'type'         => 'fieldset',
            'collapsible'  => true,
            'collapsed'    => false,
108
            'class'        => 'sectioned',
109
110
111
112
113
            'legend'       => get_string('settings'),
            'elements'     => array(),
        ),
        'submit' => array(
            'type'         => 'submitcancel',
114
            'class'        => 'btn btn-success',
115
116
            'value'        => array(get_string('savegroup', 'group'), get_string('cancel')),
            'goto'         => get_config('wwwroot') . 'group/mygroups.php',
117
118
119
        ),
    ),
);
120

121
122
$elements = array();

123
124
125
126
127
128
$elements['membership'] = array(
    'type'         => 'html',
    'title'        => get_string('Membership', 'group'),
    'value'        => '',
);

129
130
131
132
$cancreatecontrolled = $USER->get('admin') || $USER->get('staff')
    || $USER->is_institutional_admin() || $USER->is_institutional_staff();

$elements['open'] = array(
133
    'type'         => 'switchbox',
134
135
    'title'        => get_string('Open', 'group'),
    'description'  => get_string('opendescription', 'group'),
136
137
    'defaultvalue' => $group_data->open,
    'disabled'     => !$cancreatecontrolled && $group_data->controlled,
138
);
139
if ($cancreatecontrolled || $group_data->controlled) {
140
    $elements['controlled'] = array(
141
        'type'         => 'switchbox',
142
143
        'title'        => get_string('Controlled', 'group'),
        'description'  => get_string('controlleddescription', 'group'),
144
        'defaultvalue' => $group_data->controlled,
145
146
        'disabled'     => !$cancreatecontrolled,
    );
147
}
148
149
150
else {
    $form['elements']['controlled'] = array(
        'type'         => 'hidden',
151
        'value'        => $group_data->controlled,
152
153
154
    );
}
$elements['request'] = array(
155
    'type'         => 'switchbox',
156
157
    'title'        => get_string('request', 'group'),
    'description'  => get_string('requestdescription', 'group'),
158
159
    'defaultvalue' => !$group_data->open && $group_data->request,
    'disabled'     => $group_data->open,
160
161
162
163
);

// The grouptype determines the allowed roles
$grouptypeoptions = group_get_grouptype_options($group_data->grouptype);
164

165
166
// Hide the grouptype option if it was passed in as a parameter, if the user
// isn't allowed to change it, or if there's only one option.
167
168
169
if (!$id) {
    $grouptypeparam = param_alphanumext('grouptype', 0);
    if (isset($grouptypeoptions[$grouptypeparam])) {
170
171
        $group_data->grouptype = $grouptypeparam;
        $forcegrouptype = true;
172
173
    }
}
174
175
176
177
178
179
180
181
182
183
184
185
else if (!isset($grouptypeoptions[$group_data->grouptype])) {
    // The user can't create groups of this type.  Probably a non-staff user
    // who's been promoted to admin of a controlled group.
    $forcegrouptype = true;
}

if (!empty($forcegrouptype) || count($grouptypeoptions) < 2) {
    $form['elements']['grouptype'] = array(
        'type'         => 'hidden',
        'value'        => $group_data->grouptype,
    );
}
186
187
188
189
190
191
192
193
194
else {
    $elements['grouptype'] = array(
        'type'         => 'select',
        'title'        => get_string('Roles', 'group'),
        'options'      => $grouptypeoptions,
        'defaultvalue' => $group_data->grouptype,
        'help'         => true
    );
}
195

196
$elements['invitefriends'] = array(
197
    'type'         => 'switchbox',
198
    'title'        => get_string('friendinvitations', 'group'),
199
    'description'  => get_string('invitefriendsdescription1', 'group'),
200
201
202
203
    'defaultvalue' => $group_data->invitefriends,
);

$elements['suggestfriends'] = array(
204
    'type'         => 'switchbox',
205
    'title'        => get_string('Recommendations', 'group'),
206
    'description'  => get_string('suggestfriendsdescription1', 'group'),
207
    'defaultvalue' => $group_data->suggestfriends && ($group_data->open || $group_data->request),
208
    'disabled'     => !$group_data->open && !$group_data->request,
209
210
);

211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
$elements['pages'] = array(
    'type'         => 'html',
    'title'        => get_string('views'),
    'value'        => '',
);

$elements['editroles'] = array(
    'type'         => 'select',
    'options'      => group_get_editroles_options(),
    'title'        => get_string('editroles', 'group'),
    'description'  => get_string('editrolesdescription', 'group'),
    'defaultvalue' => $group_data->editroles,
    'help'         => true,
);

226
227
if ($cancreatecontrolled) {
    $elements['submittableto'] = array(
228
        'type'         => 'switchbox',
229
230
        'title'        => get_string('allowsubmissions', 'group'),
        'description'  => get_string('allowssubmissionsdescription1', 'group'),
231
232
        'defaultvalue' => $group_data->submittableto,
    );
233
    $elements['allowarchives'] = array(
234
        'type'         => 'switchbox',
235
236
237
238
239
240
        'title'        => get_string('allowsarchives', 'group'),
        'description'  => get_string('allowsarchivesdescription', 'group'),
        'defaultvalue' => $group_data->allowarchives,
        'disabled'     => !$group_data->submittableto,
        'help'         => true,
    );
241
242
243
244
245
246
}
else {
    $form['elements']['submittableto'] = array(
        'type'         => 'hidden',
        'value'        => $group_data->submittableto,
    );
247
248
249
250
    $form['elements']['allowarchives'] = array(
        'type'         => 'hidden',
        'value'        => $group_data->allowarchives,
    );
251
252
}

253
$publicallowed = get_config('createpublicgroups') == 'all' || (get_config('createpublicgroups') == 'admins' && $USER->get('admin'));
254
$publicallowed = $publicallowed && !is_probationary_user();
255

256
257
258
259
if (!$id && !param_exists('pieform_editgroup')) {
    // If a 'public=0' parameter is passed on the first page load, hide the
    // public checkbox.  The only purpose of this is to allow custom create
    // group buttons/links which lead to a slightly simplified form.
260
261
262
    $publicparam = param_integer('public', null);
}

263
264
265
266
267
268
269
270
271
272
$ignorepublic = !$publicallowed || (isset($publicparam) && $publicparam === 0);

if ($cancreatecontrolled || !$ignorepublic) {
    $elements['visibility'] = array(
        'type'         => 'html',
        'title'        => get_string('Visibility'),
        'value'        => '',
    );
}

273
$elements['public'] = array(
274
    'type'         => 'switchbox',
275
    'title'        => get_string('publiclyviewablegroup', 'group'),
276
    'description'  => get_string('publiclyviewablegroupdescription1', 'group'),
277
278
    'defaultvalue' => $group_data->public,
    'help'         => true,
279
280
281
282
283
    'ignore'       => $ignorepublic,
);

if ($cancreatecontrolled) {
    $elements['hidden'] = array(
284
        'type'         => 'switchbox',
285
        'title'        => get_string('hiddengroup', 'group'),
286
        'description'  => get_string('hiddengroupdescription1', 'group'),
287
288
        'defaultvalue' => $group_data->hidden,
    );
289
    $elements['hidemembers'] = array(
290
        'type'         => 'switchbox',
291
292
        'title'        => get_string('hidemembers', 'group'),
        'description'  => get_string('hidemembersdescription', 'group'),
293
294
        'defaultvalue' => $group_data->hidemembers || $group_data->hidemembersfrommembers,
        'disabled'     => $group_data->hidemembersfrommembers,
295
    );
296
    $elements['hidemembersfrommembers'] = array(
297
        'type'         => 'switchbox',
298
        'title'        => get_string('hidemembersfrommembers', 'group'),
299
        'description'  => get_string('hidemembersfrommembersdescription1', 'group'),
300
301
        'defaultvalue' => $group_data->hidemembersfrommembers,
    );
302
303
304
305
306
307
}
else {
    $form['elements']['hidden'] = array(
        'type'         => 'hidden',
        'value'        => $group_data->hidden,
    );
308
309
    $form['elements']['hidemembers'] = array(
        'type'         => 'hidden',
310
        'value'        => $group_data->hidemembers || $group_data->hidemembersfrommembers,
311
    );
312
313
314
315
    $form['elements']['hidemembersfrommembers'] = array(
        'type'         => 'hidden',
        'value'        => $group_data->hidemembersfrommembers,
    );
316
317
}

318
$elements['groupparticipationreports'] = array(
319
    'type'         => 'switchbox',
320
    'title'        => get_string('groupparticipationreports', 'group'),
321
    'description'  => get_string('groupparticipationreportsdesc1', 'group'),
322
323
324
    'defaultvalue' => $group_data->groupparticipationreports,
);

325
326
327
328
329
330
331
332
333
334
335
336
$elements['editability'] = array(
    'type'         => 'html',
    'title'        => get_string('editability', 'group'),
    'value'        => '',
);

$currentdate = getdate();

$elements['editwindowstart'] = array (
    'type'         => 'date',
    'title'        => get_string('windowstart', 'group'),
    'defaultvalue' => $group_data->editwindowstart,
337
    'description'  => get_string('windowstartdesc', 'group'),
338
339
340
341
342
343
344
345
346
    'minyear'      => $currentdate['year'],
    'maxyear'      => $currentdate['year'] + 20,
    'time'         => true
);

$elements['editwindowend'] = array (
    'type'         => 'date',
    'title'        => get_string('windowend', 'group'),
    'defaultvalue' => $group_data->editwindowend,
347
    'description'  => get_string('windowenddesc', 'group'),
348
349
350
351
352
    'minyear'      => $currentdate['year'],
    'maxyear'      => $currentdate['year'] + 20,
    'time'         => true
);

353
354
355
356
$elements['general'] = array(
    'type'         => 'html',
    'title'        => get_string('general'),
    'value'        => '',
357
358
);

359
360
361
if (get_config('allowgroupcategories')
    && $groupcategories = get_records_menu('group_category','','','displayorder', 'id,title')
) {
362
    $elements['category'] = array(
363
364
                'type'         => 'select',
                'title'        => get_string('groupcategory', 'group'),
365
                'options'      => array('0'=>get_string('nocategoryselected', 'group')) + $groupcategories,
366
                'defaultvalue' => $group_data->category);
367
368
369
370

    // If it's a new group & the category was passed as a parameter, hide it in the form.
    $groupcategoryparam = param_integer('category', 0);
    if (!$id && isset($groupcategories[$groupcategoryparam])) {
371
        $form['elements']['category'] = array(
372
373
374
375
376
377
            'type'  => 'hidden',
            'value' => $groupcategoryparam,
        );
    }
}

378
$elements['usersautoadded'] = array(
379
            'type'         => 'switchbox',
380
            'title'        => get_string('usersautoadded', 'group'),
381
            'description'  => get_string('usersautoaddeddescription1', 'group'),
382
            'defaultvalue' => $group_data->usersautoadded,
383
            'help'         => true,
384
            'ignore'       => !$USER->get('admin'));
385
$notifyroles = array(get_string('none', 'admin')) + group_get_editroles_options(true);
386
$elements['viewnotify'] = array(
387
    'type' => 'select',
388
    'title' => get_string('viewnotify', 'group'),
389
390
    'options' => $notifyroles,
    'description' => get_string('viewnotifydescription2', 'group'),
391
392
    'defaultvalue' => $group_data->viewnotify
);
393
394
395
396
$elements['feedbacknotify'] = array(
    'type' => 'select',
    'title' => get_string('feedbacknotify', 'group'),
    'options' => $notifyroles,
397
    'description' => get_string('feedbacknotifydescription1', 'group'),
398
399
    'defaultvalue' => $group_data->feedbacknotify
);
400
401
if ($cancreatecontrolled) {
    $elements['sendnow'] = array(
402
        'type'         => 'switchbox',
403
        'title'        => get_string('allowsendnow', 'group'),
404
        'description'  => get_string('allowsendnowdescription1', 'group'),
405
406
407
408
409
410
411
412
413
        'defaultvalue' => $group_data->sendnow
    );
}
else {
    $form['elements']['sendnow'] = array(
        'type'         => 'hidden',
        'value'        => $group_data->sendnow,
    );
}
414
415
$form['elements']['settings']['elements'] = $elements;
$editgroup = pieform($form);
Martyn Smith's avatar
Martyn Smith committed
416

417
function editgroup_validate(Pieform $form, $values) {
418
419
420
    global $group_data;
    if ($group_data->name != $values['name']) {
        // This check has not always been case-insensitive; don't use get_record in case we get >1 row back.
421
422
423
424
        if ($ids = get_records_sql_array('SELECT id FROM {group} WHERE LOWER(TRIM(name)) = ?', array(strtolower(trim($values['name']))))) {
            if (count($ids) > 1 || $ids[0]->id != $group_data->id) {
                $form->set_error('name', get_string('groupalreadyexists', 'group'));
            }
425
        }
Martyn Smith's avatar
Martyn Smith committed
426
    }
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445

    if (isset($values['urlid']) && get_config('cleanurls')) {
        $urlidlength = strlen($values['urlid']);
        if ($group_data->urlid != $values['urlid']) {
            if ($urlidlength && record_exists('group', 'urlid', $values['urlid'])) {
                $form->set_error('urlid', get_string('groupurltaken', 'group'));
            }
            else if (!$urlidlength) {
                // Once you've set a group url, there's no going back
                $form->set_error('urlid', get_string('rule.minlength.minlength', 'pieforms', 3));
            }
        }
        // If the urlid is empty, we'll generate it when creating a group, but if it's 1 or 2 characters
        // long, it's an error.
        if ($urlidlength > 0 && $urlidlength < 3) {
            $form->set_error('urlid', get_string('rule.minlength.minlength', 'pieforms', 3));
        }
    }

446
447
448
449
450
451
452
453
    if (!empty($values['open'])) {
        if (!empty($values['controlled'])) {
            $form->set_error('open', get_string('membershipopencontrolled', 'group'));
        }
        if (!empty($values['request'])) {
            $form->set_error('request', get_string('membershipopenrequest', 'group'));
        }
    }
454
455
456
    if (!empty($values['invitefriends']) && !empty($values['suggestfriends'])) {
        $form->set_error('invitefriends', get_string('suggestinvitefriends', 'group'));
    }
457
458
459
    if (!empty($values['suggestfriends']) && empty($values['open']) && empty($values['request'])) {
        $form->set_error('suggestfriends', get_string('suggestfriendsrequesterror', 'group'));
    }
460
461
462
    if (!empty($values['editwindowstart']) && !empty($values['editwindowend']) && ($values['editwindowstart'] >= $values['editwindowend'])) {
        $form->set_error('editwindowend', get_string('editwindowendbeforestart', 'group'));
    }
Martyn Smith's avatar
Martyn Smith committed
463
464
}

465
function editgroup_cancel_submit() {
466
    redirect('/group/mygroups.php');
Martyn Smith's avatar
Martyn Smith committed
467
468
}

469
function editgroup_submit(Pieform $form, $values) {
470
    global $USER, $SESSION, $group_data, $publicallowed;
Martyn Smith's avatar
Martyn Smith committed
471

472
    $values['public'] = (isset($values['public'])) ? $values['public'] : 0;
473
    $values['usersautoadded'] = (isset($values['usersautoadded'])) ? $values['usersautoadded'] : 0;
474

475
    $newvalues = array(
476
477
        'name'           => $group_data->name == $values['name'] ? $values['name'] : trim($values['name']),
        'description'    => $values['description'],
478
        'grouptype'      => $values['grouptype'],
479
        'category'       => empty($values['category']) ? null : intval($values['category']),
480
481
482
        'open'           => intval($values['open']),
        'controlled'     => intval($values['controlled']),
        'request'        => intval($values['request']),
483
        'usersautoadded' => intval($values['usersautoadded']),
484
        'public'         => ($publicallowed ? intval($values['public']) : 0),
485
        'viewnotify'     => intval($values['viewnotify']),
486
        'submittableto'  => intval($values['submittableto']),
487
        'allowarchives'  => intval(!empty($values['allowarchives']) ? $values['allowarchives'] : 0),
488
        'editroles'      => $values['editroles'],
489
        'hidden'         => intval($values['hidden']),
490
        'hidemembers'    => intval(!empty($values['hidemembersfrommembers']) || !empty($values['hidemembers'])),
491
        'hidemembersfrommembers' => intval($values['hidemembersfrommembers']),
492
        'groupparticipationreports' => intval($values['groupparticipationreports']),
493
494
        'invitefriends'  => intval($values['invitefriends']),
        'suggestfriends' => intval($values['suggestfriends']),
495
        'editwindowstart' => db_format_timestamp($values['editwindowstart']),
496
        'editwindowend'  => db_format_timestamp($values['editwindowend']),
497
498
        'sendnow'        => intval($values['sendnow']),
        'feedbacknotify'     => intval($values['feedbacknotify']),
Martyn Smith's avatar
Martyn Smith committed
499
500
    );

501
502
503
504
505
    if (
            get_config('cleanurls')
            && isset($values['urlid'])
            && '' !== (string) $values['urlid']
    ) {
506
507
508
        $newvalues['urlid'] = $values['urlid'];
    }

509
510
    db_begin();

511
512
    $newvalues['description'] = EmbeddedImage::prepare_embedded_images($newvalues['description'], 'group', $group_data->id, $group_data->id);

513
514
515
516
517
518
519
520
521
    if ($group_data->id) {
        $newvalues['id'] = $group_data->id;
        group_update((object)$newvalues);
    }
    else {
        $newvalues['members'] = array($USER->get('id') => 'admin');
        $group_data->id = group_create($newvalues);
        $USER->reset_grouproles();
    }
522

523
    $SESSION->add_ok_msg(get_string('groupsaved', 'group'));
Martyn Smith's avatar
Martyn Smith committed
524
525
526

    db_commit();

527
    // Reload $group_data->urlid or else the redirect will fail
528
    if (get_config('cleanurls') && (!isset($values['urlid']) || $group_data->urlid != $values['urlid'])) {
529
530
531
532
        $group_data->urlid = get_field('group', 'urlid', 'id', $group_data->id);
    }

    redirect(group_homepage_url($group_data));
Martyn Smith's avatar
Martyn Smith committed
533
534
}

535
536
537
$js = '
$j(function() {
    $j("#editgroup_controlled").click(function() {
538
        if (this.checked) {
539
540
            $j("#editgroup_request").removeAttr("disabled");
            $j("#editgroup_open").removeAttr("checked");
541
542
543
544
            if (!$j("#editgroup_request").attr("checked")) {
                $j("#editgroup_suggestfriends").removeAttr("checked");
                $j("#editgroup_suggestfriends").attr("disabled", true);
            }
545
546
547
        }
    });
    $j("#editgroup_open").click(function() {
548
        if (this.checked) {
549
550
551
            $j("#editgroup_controlled").removeAttr("checked");
            $j("#editgroup_request").removeAttr("checked");
            $j("#editgroup_request").attr("disabled", true);
552
            $j("#editgroup_suggestfriends").removeAttr("disabled");
553
554
555
        }
        else {
            $j("#editgroup_request").removeAttr("disabled");
556
557
558
559
560
561
562
            if (!$j("#editgroup_request").attr("checked")) {
                $j("#editgroup_suggestfriends").removeAttr("checked");
                $j("#editgroup_suggestfriends").attr("disabled", true);
            }
        }
    });
    $j("#editgroup_request").click(function() {
563
        if (this.checked) {
564
565
566
567
568
569
570
            $j("#editgroup_suggestfriends").removeAttr("disabled");
        }
        else {
            if (!$j("#editgroup_open").attr("checked")) {
                $j("#editgroup_suggestfriends").removeAttr("checked");
                $j("#editgroup_suggestfriends").attr("disabled", true);
            }
571
572
        }
    });
573
    $j("#editgroup_invitefriends").click(function() {
574
        if (this.checked) {
575
576
577
            if ($j("#editgroup_request").attr("checked") || $j("#editgroup_open").attr("checked")) {
                $j("#editgroup_suggestfriends").removeAttr("disabled");
            }
578
579
580
581
            $j("#editgroup_suggestfriends").removeAttr("checked");
        }
    });
    $j("#editgroup_suggestfriends").click(function() {
582
        if (this.checked) {
583
584
585
            $j("#editgroup_invitefriends").removeAttr("checked");
        }
    });
586
    $j("#editgroup_hidemembersfrommembers").click(function() {
587
        if (this.checked) {
588
589
590
591
592
593
594
            $j("#editgroup_hidemembers").attr("checked", true);
            $j("#editgroup_hidemembers").attr("disabled", true);
        }
        else {
            $j("#editgroup_hidemembers").removeAttr("disabled");
        }
    });
595
596
597
598
599
600
601
602
603
    $j("#editgroup_submittableto").click(function() {
        if (this.checked) {
            $j("#editgroup_allowarchives").attr("disabled", false);
        }
        else {
            $j("#editgroup_allowarchives").removeAttr("checked");
            $j("#editgroup_allowarchives").attr("disabled", true);
        }
    });
604
605
606
});
';

607
$smarty = smarty();
608
609
$smarty->assign('form', $editgroup);
$smarty->assign('PAGEHEADING', TITLE);
610
$smarty->assign('INLINEJAVASCRIPT', $js);
611
$smarty->display('form.tpl');