change_user_groups

NAML documentation   Watch a video
   Usages of this macro
... in change_user_groups.naml
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
<macro name="change_user_groups" requires="servlet">
    <n.user_page
Macro
Requires: servlet
Parameters: do
.>
        <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.not
Binary
Namespace: BasicNamespace
Parameters: condition
.visitor
Binary
Namespace: ServletNamespace
Parameters: do
.can_manage_users_and_groups
Macro
Requires: user
>
            <then>
                <n.login
Macro
Requires: servlet
Parameters: message
.><t>Only authorized users can proceed in this area.</t></n.login.>
            </then>
        </n.if.not.visitor.can_manage_users_and_groups>
        <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.is_submitted_form
Macro
Requires: servlet
>
            <then>
                <n.catch_exception
Binary
Namespace: BasicNamespace
Parameters: id, do
. id="save-block">
                    <n.edit_page_user
Binary
Namespace: UserPageNamespace
Parameters: commit, do
.>
                        <n.user_group_list
Macro
Parameters: do
.loop
Macro
Requires: sequence
Parameters: by, do
.group_field
Macro
Parameters: do, group
. group="[n.current_group
Binary
Namespace: GroupList
/]">
                            <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.is_checked
Macro
Requires: field
>
                                 <then><n.add_to_group
Binary
Namespace: UserEditorNamespace
Parameters: group
.current_group
Binary
Namespace: GroupList
/></then>
                                 <else><n.remove_from_group
Binary
Namespace: UserEditorNamespace
Parameters: group
.current_group
Binary
Namespace: GroupList
/></else>
                            </n.if.is_checked>
                        </n.user_group_list.loop.group_field.>
                        <n.get_parameter_values
Binary
Namespace: RequestNamespace
Parameters: name, do
. name="newgroup">
                            <n.loop
Macro
Requires: sequence
Parameters: by, do
.>
                                <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.not
Binary
Namespace: BasicNamespace
Parameters: condition
.is_empty
Binary
Namespace: BasicNamespace
Parameters: value
.current_parameter_value
Binary
Namespace: ParameterValueList
>
                                     <then><n.add_to_group
Binary
Namespace: UserEditorNamespace
Parameters: group
.current_parameter_value
Binary
Namespace: ParameterValueList
/></then>
                                </n.if.not.is_empty.current_parameter_value>
                            </n.loop.>
                        </n.get_parameter_values.>
                    </n.edit_page_user.>
                    <n.redirect_to
Binary
Namespace: ServletNamespace
Parameters: url
.page_user
Binary
Namespace: UserPageNamespace
Parameters: do
.url
Macro
Requires: user
Parameters: filter, index_record
/>
                </n.catch_exception.>
            </then>
        </n.if.is_submitted_form>
        <n.html
Macro
Parameters: head, body
>
            <head>
                <META NAME="robots" CONTENT="noindex,nofollow"/>
                <n.title
Macro
Parameters: text
.><t>Change User Groups</t></n.title.>
                <style type="text/css">
                    .title-row {
                        padding:.2em;
                        border-bottom-width:2px;
                        border-bottom-style:solid;
                        font-weight:bold;
                    }
                </style>
            </head>
            <body>
                <n.page_user
Binary
Namespace: UserPageNamespace
Parameters: do
.profile_header
Macro
Requires: user
/>
 
                <div class="title-row light-border-color" style="margin-top:.5em">
                    <t>Groups of this user</t>
                </div>
                <n.form
Macro
Requires: servlet
Parameters: macro, method, onsubmit, content
.>
                    <table>
                        <n.fixed_group_row
Macro
Parameters: name, tip
 name="[n.anyone_group
Binary
Namespace: NabbleNamespace
/]" tip="[t]All users belong to this group[/t]"/>
                        <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.page_user
Binary
Namespace: UserPageNamespace
Parameters: do
.is_registered
Binary
Namespace: UserNamespace
>
                            <then><n.fixed_group_row
Macro
Parameters: name, tip
 name="[n.registered_group
Binary
Namespace: NabbleNamespace
/]" tip="[t]Users that completed the registration process[/t]"/></then>
                        </n.if.page_user.is_registered>
 
                        <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.page_user
Binary
Namespace: UserPageNamespace
Parameters: do
.is_authenticated
Binary
Namespace: UserNamespace
>
                            <then>
                                <n.user_group_list
Macro
Parameters: do
.loop
Macro
Requires: sequence
Parameters: by, do
.>
                                    <n.group_row
Macro
Parameters: checked, group
>
                                        <group><n.current_group
Binary
Namespace: GroupList
/></group>
                                        <checked><n.page_user
Binary
Namespace: UserPageNamespace
Parameters: do
.is_in_group
Binary
Namespace: UserNamespace
Parameters: group
.current_group
Binary
Namespace: GroupList
/></checked>
                                    </n.group_row>
                                </n.user_group_list.loop.>
 
                                <n.empty_group_controls
Macro
/>
                            </then>
                        </n.if.page_user.is_authenticated>
                    </table>
 
                    <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.page_user
Binary
Namespace: UserPageNamespace
Parameters: do
.is_authenticated
Binary
Namespace: UserNamespace
>
                        <then>
                            <div style="margin-top:1.4em">
                                <input type="submit" value="[t]Save Changes[/t]" />
                                <t>or</t> <a href="[n.page_user
Binary
Namespace: UserPageNamespace
Parameters: do
.url
Macro
Requires: user
Parameters: filter, index_record
/]"><t>Cancel</t></a>
                            </div>
                        </then>
                    </n.if.page_user.is_authenticated>
                </n.form.>
            </body>
        </n.html>
    </n.user_page.>
</macro>