summaryrefslogtreecommitdiffstats
path: root/examples/setting.modal.view.php
blob: 2217805a5ec6e352dd2e1c747f3eade511c19681 (plain) (blame)
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<?php

/*
 * SCROTT Copyright (C) 2016 Malf Furious
 *
 * Scrott is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 *
 * Scrott is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 * License for more details.
 */

?>

<div id="settingModal" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">&times;</span>
                </button>

                <h4 class="modal-title"><span class="glyphicon glyphicon-cog"></span> Settings</h4>

            </div>

            <div class="modal-body">
                <ul class="nav nav-tabs" role="tablist">
                    <?php if ($mod->common_settingShowTab['group']) { ?>
                        <li class="<?=$mod->getSettingModalTabActiveClass()?>"><a href="#settGroupTab" aria-controls="settGroupTab" data-toggle="tab">
                            <span class="glyphicon glyphicon-th"></span> <?=$mod->group->name?>
                        </a></li>
                    <?php } ?>

                    <li class="<?=$mod->getSettingModalTabActiveClass()?>"><a href="#settUserTab" aria-controls="settUserTab" data-toggle="tab">
                        <span class="glyphicon glyphicon-user"></span> <?=$mod->getCurrentUser()->getDisplayName()?>
                    </a></li>

                    <?php if ($mod->getCurrentUser()->admin == 1) { ?>
                        <li><a href="#settAdminTab" aria-controls="settAdminTab" data-toggle="tab"><span class="glyphicon glyphicon-sunglasses"></span> Admin</a></li>
                        <li><a href="#settUsersTab" aria-controls="settUsersTab" data-toggle="tab"><span class="glyphicon glyphicon-th"></span> All Users</a></li>
                    <?php } ?>
                </ul>

                <div class="tab-content">
                    <?php if ($mod->common_settingShowTab['group']) { ?>
                        <?php include "view/common/group.setting.modal.view.php"; ?>
                    <?php } ?>

                    <div class="tab-pane fade <?=$mod->getSettingModalTabDispClasses()?>" id="settUserTab">
                        <p>&nbsp;</p>

                        <form method="post" action="<?=$mod->ap()?>" enctype="multipart/form-data">
                            <input type="hidden" name="input[action]" value="common-setting-user" />

                            <div class="row">
                                <div class="col-md-8">
                                    <?php if ($mod->getCurrentUser()->admin == 1) { ?>
                                        <p class="pull-right"><span class="glyphicon glyphicon-sunglasses"></span> <?=$mod->getCurrentUser()->getDisplayName()?> is a Scrott Administrator</p>
                                    <?php } ?>

                                    <div class="form-group">
                                        <label>Username</label>
                                        <input type="text" class="form-control" value="<?=$mod->getCurrentUser()->name?>" disabled />
                                    </div>

                                    <div class="checkbox">
                                        <label data-toggle="collapse" data-target="#inputUserPasswdCollapse">
                                            <input type="checkbox" name="input[setPasswd]" value="1" /> Change Password
                                        </label>
                                    </div>
                                </div>

                                <div class="col-md-4 text-center">
                                    <img src="<?=$mod->getCurrentUser()->getHeadImage()?>" alt="<?=$mod->getCurrentUser()->getDisplayName()?>" class="img-circle" height="100" />
                                    <br />
                                    <br />
                                    <button type="button" class="btn btn-default btn-xs" data-toggle="collapse" data-target="#inputUserImageCollapse">
                                        <span class="glyphicon glyphicon-camera"></span> Upload new image
                                    </button>
                                    <br />
                                    <button type="submit" name="input[rmImage]" class="btn btn-danger btn-xs" onclick="return assertConfirm()">
                                        <span class="glyphicon glyphicon-remove"></span> Remove image
                                    </button>
                                </div>
                            </div>

                            <div class="collapse" id="inputUserImageCollapse">
                                <div class="form-group">
                                    <label>User Image</label>
                                    <input type="file" name="attachment" />
                                </div>
                            </div>

                            <div class="collapse" id="inputUserPasswdCollapse">
                                <div class="form-group">
                                    <label>Current Password</label>
                                    <input type="password" name="input[curPasswd]" class="form-control" />
                                </div>

                                <div class="form-group">
                                    <label>New Password</label>
                                    <input type="password" name="input[newPasswd]" class="form-control" />
                                </div>

                                <div class="form-group">
                                    <label>Confirm Password</label>
                                    <input type="password" name="input[confPasswd]" class="form-control" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label>Alias</label>
                                <input type="text" name="input[alias]" class="form-control" value="<?=$mod->getCurrentUser()->alias?>" maxlength="50" />
                            </div>

                            <div class="form-group">
                                <label>Email</label>
                                <input type="text" name="input[email]" class="form-control" value="<?=$mod->getCurrentUser()->email?>" maxlength="50" />
                            </div>

                            <?php if ($mod->getCurrentUser()->email != "" && $mod->getCurrentUser()->emailConf == 0) { ?>
                                <div class="form-group has-warning">
                                    <label class="control-label">Email Confirmation Key</label>
                                    <input type="text" name="input[emailConfKey]" class="form-control" />
                                    <span class="help-block">You have not yet confirmed ownership of your saved email address</span>
                                </div>
                            <?php } ?>

                            <button type="submit" class="btn btn-success pull-right">Save</button>
                        </form>

                        <p>&nbsp;</p>
                        <p>&nbsp;</p>

                        <a href="<?=$mod->ar()?>/deleteaccount" class="btn btn-danger btn-xs pull-right"><span class="glyphicon glyphicon-trash"></span> Delete Account</a>

                        <p>&nbsp;</p>
                    </div>

                    <?php if ($mod->getCurrentUser()->admin == 1) { ?>
                        <div class="tab-pane fade" id="settAdminTab">
                            <p>&nbsp;</p>

                            <form method="post" action="<?=$mod->ap()?>">
                                <input type="hidden" name="input[action]" value="common-setting-admin" />
                                <div class="form-group">
                                    <label>HTTP(S)</label>
                                    <div class="radio">
                                        <label>
                                            <input type="radio" name="input[settSSL]" value="force" <?=$mod->common_settingAdminSettSSLChecked['force']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
                                            Always Force SSL
                                        </label>
                                    </div>

                                    <div class="radio">
                                        <label>
                                            <input type="radio" name="input[settSSL]" value="neither" <?=$mod->common_settingAdminSettSSLChecked['neither']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
                                            Neither
                                        </label>
                                    </div>

                                    <div class="radio">
                                        <label>
                                            <input type="radio" name="input[settSSL]" value="forbid" <?=$mod->common_settingAdminSettSSLChecked['forbid']?> <?=$mod->common_settingAdminSettSSLDisabled?> />
                                            Always Forbid SSL
                                        </label>
                                    </div>
                                </div>

                                <label>Access</label>
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" name="input[allowPublicSignup]" value="1" <?=$mod->common_settingAdminAllowPublicSignupChecked?> /> Allow anyone to create an account
                                    </label>
                                </div>

                                <button type="submit" class="btn btn-success pull-right">Save</button>
                            </form>

                            <p>&nbsp;</p>
                        </div>

                        <div class="tab-pane fade" id="settUsersTab">
                            <p>&nbsp;</p>

                            <div class="panel-group" id="common-setting-allusers">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h4 class="panel-title">
                                            <a href="#common-setting-allusers-add-collapse" data-toggle="collapse" data-parent="#common-setting-allusers" aria-expanded="false">
                                                <span class="glyphicon glyphicon-plus"></span> Add New User
                                            </a>
                                        </h4>
                                    </div>

                                    <div class="panel-collapse collapse" id="common-setting-allusers-add-collapse">
                                        <div class="panel-body">
                                            <form method="post" action="<?=$mod->ap()?>">
                                                <input type="hidden" name="input[action]" value="common-setting-allusers-adduser" />
                                                <div class="form-group">
                                                    <label>Username</label>
                                                    <input type="text" name="input[username]" class="form-control" required="true" maxlength="50" />
                                                </div>

                                                <div class="form-group">
                                                    <label>Password</label>
                                                    <input type="password" name="input[password]" class="form-control" />
                                                </div>

                                                <div class="form-group">
                                                    <label>Confirm Password</label>
                                                    <input type="password" name="input[cPassword]" class="form-control" />
                                                </div>

                                                <div class="checkbox">
                                                    <label>
                                                        <input type="checkbox" name="input[admin]" value="1" /> Administrator
                                                    </label>
                                                </div>

                                                <div class="form-group">
                                                    <label>Alias</label>
                                                    <input type="text" name="input[alias]" class="form-control" maxlength="50" />
                                                </div>

                                                <div class="form-group">
                                                    <label>Email</label>
                                                    <input type="text" name="input[email]" class="form-control" maxlength="50" />
                                                </div>

                                                <button type="submit" class="btn btn-success pull-right">Add</button>
                                            </form>
                                        </div>
                                    </div>
                                </div>

                                <?php foreach ($mod->common_settingAllUsers as $user) { ?>
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            <h4 class="panel-title">
                                                <a href="#common-setting-allusers-<?=$user->guid?>-collapse" data-toggle="collapse" data-parent="#common-setting-allusers" aria-expanded="false">
                                                    <span class="<?=$user->getGlyphicon()?>"></span> <?=$user->name?> <?=($user->alias != "" ? "(" . $user->alias . ")" : "")?>
                                                </a>
                                            </h4>
                                        </div>

                                        <div class="panel-collapse collapse" id="common-setting-allusers-<?=$user->guid?>-collapse">
                                            <div class="panel-body">
                                                <form method="post" action="<?=$mod->ap()?>" enctype="multipart/form-data">
                                                    <input type="hidden" name="input[action]" value="common-setting-allusers-edituser" />
                                                    <input type="hidden" name="input[guid]" value="<?=$user->guid?>" />

                                                    <div class="row">
                                                        <div class="col-md-8">
                                                            <div class="form-group">
                                                                <label>Username</label>
                                                                <input type="text" class="form-control" value="<?=$user->name?>" disabled />
                                                            </div>

                                                            <div class="checkbox">
                                                                <label data-toggle="collapse" data-target="#input<?=$user->guid?>PasswdCollapse">
                                                                    <input type="checkbox" name="input[setPasswd]" value="1" /> Change Password
                                                                </label>
                                                            </div>
                                                        </div>

                                                        <div class="col-md-4 text-center">
                                                            <img src="<?=$user->getHeadImage()?>" alt="<?=$user->getDisplayName()?>" class="img-circle" height="100" />
                                                            <br />
                                                            <br />
                                                            <button type="button" class="btn btn-default btn-xs" data-toggle="collapse" data-target="#input<?=$user->guid?>ImageCollapse">
                                                                <span class="glyphicon glyphicon-camera"></span> Upload new image
                                                            </button>
                                                            <br />
                                                            <button type="submit" name="input[rmImage]" class="btn btn-danger btn-xs" onclick="return assertConfirm()">
                                                                <span class="glyphicon glyphicon-remove"></span> Remove image
                                                            </button>
                                                        </div>
                                                    </div>

                                                    <div class="collapse" id="input<?=$user->guid?>ImageCollapse">
                                                        <div class="form-group">
                                                            <label>User Image</label>
                                                            <input type="file" name="attachment" />
                                                        </div>
                                                    </div>

                                                    <div class="collapse" id="input<?=$user->guid?>PasswdCollapse">
                                                        <div class="form-group">
                                                            <label>New Password</label>
                                                            <input type="password" name="input[newPasswd]" class="form-control" />
                                                        </div>

                                                        <div class="form-group">
                                                            <label>Confirm Password</label>
                                                            <input type="password" name="input[confPasswd]" class="form-control" />
                                                        </div>
                                                    </div>

                                                    <div class="checkbox">
                                                        <label>
                                                            <input type="checkbox" name="input[admin]" value="1" <?=($user->admin ? "checked" : "")?>> Administrator
                                                        </label>
                                                    </div>

                                                    <div class="form-group">
                                                        <label>Alias</label>
                                                        <input type="text" name="input[alias]" class="form-control" maxlength="50" value="<?=$user->alias?>" />
                                                    </div>

                                                    <div class="form-group">
                                                        <label>Email</label>
                                                        <input type="text" name="input[email]" class="form-control" maxlength="50" value="<?=$user->email?>" />
                                                    </div>

                                                    <button type="submit" class="btn btn-success pull-right">Save</button>
                                                </form>

                                                <p>&nbsp;</p>
                                                <p>&nbsp;</p>

                                                <form method="post" action="<?=$mod->ap()?>">
                                                    <input type="hidden" name="input[action]" value="common-setting-allusers-deluser" />
                                                    <input type="hidden" name="input[guid]" value="<?=$user->guid?>" />
                                                    <button type="submit" class="btn btn-danger btn-xs pull-right" onclick="return assertConfirm()">
                                                        <span class="glyphicon glyphicon-trash"></span> Delete Account
                                                    </button>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                        </div>
                    <?php } ?>
                </div>
            </div>
        </div>
    </div>
</div>