forked from szerko/Respond2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pages.php
419 lines (313 loc) · 15.9 KB
/
pages.php
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
<?php
include 'app.php'; // import php files
$authUser = new AuthUser(); // get auth user
$authUser->Authenticate('All');
Utilities::SetLanguage($authUser->Language); // set language
?>
<!DOCTYPE html>
<html lang="<?php print str_replace('_', '-', $authUser->Language) ?>">
<head>
<title><?php print _("Pages"); ?>—<?php print $authUser->SiteName; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- include css -->
<?php include 'modules/css.php'; ?>
</head>
<body data-currpage="pages" data-timezone="<?php print $authUser->TimeZone; ?>" data-offset="<?php print $authUser->Offset(); ?>">
<?php include 'modules/menu.php'; ?>
<!-- messages -->
<input id="msg-add-error" value="<?php print _("Name and Friendly URL are required"); ?>" type="hidden">
<input id="msg-adding" value="<?php print _("Adding..."); ?>" type="hidden">
<input id="msg-added" value="<?php print _("Page added successfully"); ?>" type="hidden">
<input id="msg-removing" value="<?php print _("Removing..."); ?>" type="hidden">
<input id="msg-removed" value="<?php print _("Page removed successfully"); ?>" type="hidden">
<input id="msg-remove-error" value="<?php print _("There was a problem removing the page"); ?>" type="hidden">
<input id="msg-all-required" value="<?php print _("All fields are required"); ?>" type="hidden">
<input id="msg-type-adding" value="<?php print _("Adding..."); ?>" type="hidden">
<input id="msg-type-added" value="<?php print _("Page type added successfully"); ?>" type="hidden">
<input id="msg-type-updating" value="<?php print _("Updating..."); ?>" type="hidden">
<input id="msg-type-updated" value="<?php print _("Page type updated successfully"); ?>" type="hidden">
<input id="msg-type-removing" value="<?php print _("Removing..."); ?>" type="hidden">
<input id="msg-type-removed" value="<?php print _("Page type removed successfully"); ?>" type="hidden">
<input id="msg-type-remove-error" value="<?php print _("There was a problem removing the page type"); ?>" type="hidden">
<input id="msg-unpublished" value="<?php print _("The page was un-published successfully"); ?>" type="hidden">
<input id="msg-published" value="<?php print _("The page was published successfully"); ?>" type="hidden">
<input id="msg-publish-error" value="<?php print _("There was a problem publishing/un-publishing the page"); ?>" type="hidden">
<input id="msg-category-adding" value="<?php print _("Adding..."); ?>" type="hidden">
<input id="msg-category-added" value="<?php print _("Category added successfully"); ?>" type="hidden">
<input id="msg-category-removing" value="<?php print _("Removing..."); ?>" type="hidden">
<input id="msg-category-removed" value="<?php print _("Category removed successfully"); ?>" type="hidden">
<input id="msg-category-remove-error" value="<?php print _("There was a problem removing the category"); ?>" type="hidden">
<section class="main">
<nav>
<a class="show-menu"><i class="fa fa-bars fa-lg"></i></a>
<div class="fs-container">
<div class="fs">
<ul>
<li class="root" data-bind="click: switchPageType, css: {'active': friendlyId()=='root'}"><a data-friendlyid="root" data-pagetypeuniqid="-1" data-types="Page" data-typep="Pages" data-layout="content" data-stylesheet="content">/</a></li>
<!--ko foreach: pageTypes -->
<li data-bind="css: {'active': friendlyId()==$parent.friendlyId(), 'is-secure': isSecure()==1}"><a data-bind="html: dir, attr: {'data-friendlyid': friendlyId, 'data-pagetypeuniqid': pageTypeUniqId, 'data-types': typeS, 'data-typep': typeP, 'data-layout': layout, 'data-stylesheet': stylesheet, 'data-issecure': isSecure}, click: $parent.switchPageType">
</a>
<?php if($authUser->Role=='Admin'){ ?>
<i data-bind="click: $parent.showRemovePageTypeDialog" class="fa fa-minus-circle fa-lg"></i>
<?php } ?>
</li>
<!--/ko -->
<?php if($authUser->Role=='Admin'){ ?>
<li class="add"><i class="fa fa-plus-circle fa-lg" data-bind="click: showAddPageTypeDialog"></i></li>
<?php } ?>
</ul>
</div>
<!-- /.fs -->
</div>
<!-- /.fs-container -->
<a class="primary-action" data-bind="click: showAddDialog"><i class="fa fa-plus-circle"></i> <?php print _("Add Page"); ?></a>
</nav>
<div class="list-menu">
<?php include 'modules/account.php'; ?>
<div class="list-menu-actions">
<div id="categories" class="categories btn-group" data-bind="visible: pageTypeUniqId()!=-1">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="current-category"><?php print _("All Categories"); ?></span> <i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu">
<li><a data-bind="click:resetCategory"><?php print _("All Categories"); ?></a></li>
<!--ko foreach: categories -->
<li><a data-bind="text:name, click: $parent.setCategory"></a><i data-bind="click: $parent.showRemoveCategoryDialog" class="fa fa-minus-circle remove"></i></li>
<!--/ko -->
<li role="presentation" class="divider"></li>
<li><a data-bind="click:showAddCategoryDialog"><?php print _("Add Category"); ?></a></li>
</ul>
</div>
<a title="<?php print _("Sort by Last Modified"); ?>" class="active" data-bind="click:sortDate"><i class="fa fa-sort-amount-desc"></i></a>
<a title="<?php print _("Sort by Name"); ?>"><i class="fa fa-sort-alpha-asc" data-bind="click:sortName"></i></a>
<a><i class="fa fa-cog" data-bind="click: showEditPageTypeDialog, visible: pageTypeUniqId()!=-1"></i></a>
</div>
</div>
<div class="list" data-bind="foreach: pages">
<div class="listItem" data-bind="attr: { 'data-id': pageUniqId, 'data-name': name, 'data-isactive': isActive}, css: {'has-thumb': thumb()!=''}">
<span class="image" data-bind="if: thumb()!=''"><img height="75" width="75" data-bind="attr:{'src':thumb}"></span>
<?php if($authUser->Role=='Admin'){ ?>
<a class="remove" data-bind="click: $parent.showRemoveDialog">
<i class="not-published fa fa-minus-circle fa-lg"></i>
</a>
<?php } ?>
<h2><a data-bind="text:name, attr: { 'href': editUrl }"></a> <span class="draft-tag" data-bind="visible:hasDraft"><?php print _("Draft"); ?></span></h2>
<p data-bind="text:description"></p>
<em><?php print _("Last updated"); ?> <span data-bind="text:friendlyDate"></span> <?php print _("by"); ?> <span data-bind="text:lastModifiedFullName"></span></em>
<?php if($authUser->Role=='Admin'){ ?>
<span class="status" data-bind="css: { 'published': isActive() == 1, 'not-published': isActive() == 0 }, click: $parent.toggleActive">
<i class="not-published fa fa-circle-o fa-lg"></i>
<i class="published fa fa-check-circle fa-lg"></i>
</span>
<?php } ?>
</div>
<!-- /.listItem -->
</div>
<!-- /.list -->
<p data-bind="visible: pagesLoading()" class="list-loading"><i class="fa fa-spinner fa-spin"></i> <?php print _("Loading..."); ?></p>
<p data-bind="visible: pagesLoading()==false && pages().length < 1" class="list-none"><?php print _("No pages here. Click Add Page to get started."); ?></p>
</section>
<!-- /.main -->
<div class="modal fade" id="addDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Add Page"); ?></h3>
</div>
<div class="modal-body">
<div class="form-group">
<label for="name" class="control-label"><?php print _("Name:"); ?></label>
<input id="name" type="text" value="" maxlength="255" class="form-control">
</div>
<div class="form-group">
<label for="URL" class="control-label"><?php print _("Friendly URL:"); ?></label>
<input id="friendlyId" type="text" maxlength="128" value="" placeholder="page-name" class="form-control">
<span class="help-block"><?php print _("No spaces, no special characters, dashes allowed."); ?></span>
</div>
<div class="form-group">
<label for="description" class="control-label"><?php print _("Description:"); ?></label>
<textarea id="description" class="form-control"></textarea>
</div>
<div class="form-group" data-bind="visible: categories().length>0">
<label for="categories-list" class="control-label"><?php print _("Categories:"); ?></label>
<span class="checklist categories-list" data-bind="foreach: categories">
<label class="checkbox"><input type="checkbox" data-bind="value: categoryUniqId"> <span data-bind="text:name"></span></label>
</span>
</div>
</div>
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: addPage"><?php print _("Add Page"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="deleteDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Remove Page"); ?></h3>
</div>
<div class="modal-body">
<p>
<?php print _("Confirm that you want to remove:"); ?> <strong id="removeName">this page</strong>
</p>
</div>
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: removePage"><?php print _("Remove Page"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="deletePageTypeDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Remove Page Type"); ?></h3>
</div>
<div class="modal-body">
<p data-bind="visible: pages().length == 0">
<?php print _("Confirm you want to remove:"); ?> <strong id="removePageTypeName">this page type</strong>
</p>
<p data-bind="visible: pages().length > 0">
<?php print _("Please remove all pages first."); ?></strong>
</p>
</div>
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: removePageType, visible: pages().length == 0"><?php print _("Remove Type"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="pageTypeDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">x</button>
<h3 class="add"><?php print _("Add Page Type"); ?></h3>
<h3 class="edit"><?php print _("Update Page Type"); ?></h3>
</div>
<!-- /.modal-header -->
<div class="modal-body">
<div class="form-group">
<label for="typeS" class="control-label"><?php print _("Name (singular):"); ?></label>
<input id="typeS" value="" maxlength="100" class="form-control">
<span class="add help-block"><?php print _("e.g.: Page, Blog, Product, etc."); ?></span>
</div>
<div class="form-group">
<label for="typeP" class="control-label"><?php print _("Name (Plural):"); ?></label>
<input id="typeP" value="" maxlength="100" class="form-control">
<span class="add help-block"><?php print _("e.g.: Pages, Blogs, Products, etc."); ?></span>
</div>
<div class="add form-group">
<label for="typeFriendlyId" class="control-label"><?php print _("Friendly URL:"); ?></label>
<input id="typeFriendlyId" value="" maxlength="50" class="form-control">
<span class="add help-block">e.g. http://respondcms.com/[friendly-url]/. <?php print _("Must be lowercase with no spaces."); ?></span>
</div>
<div class="form-group">
<label for="layout" class="control-label"><?php print _("Default Layout:"); ?></label>
<select id="layout" data-bind="options: layouts, value: layout" class="form-control"></select>
</div>
<div class="form-group">
<label for="stylesheet" class="control-label"><?php print _("Default Styles:"); ?></label>
<select id="stylesheet" data-bind="options: stylesheets, value: stylesheet" class="form-control"></select>
</div>
<div class="form-group">
<label for="stylesheet" class="control-label"><?php print _("Requires Login:"); ?></label>
<select id="isSecure" class="form-control">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</div>
</form>
<!-- /.form-horizontal -->
</div>
<!-- /.modal-body -->
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="add primary-button" data-bind="click: addPageType"><?php print _("Add Type"); ?></button>
<button class="edit primary-button" data-bind="click: editPageType"><?php print _("Update Type"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="addCategoryDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Add Category"); ?></h3>
</div>
<div class="modal-body">
<div class="form-group">
<label for="name" class="control-label"><?php print _("Name:"); ?></label>
<input id="categoryName" type="text" value="" maxlength="255" class="form-control">
</div>
<div class="form-group">
<label for="URL" class="control-label"><?php print _("Friendly URL:"); ?></label>
<input id="categoryFriendlyId" type="text" maxlength="128" value="" placeholder="category-name" class="form-control">
<span class="help-block">e.g. /list#category:name</span>
</div>
</div>
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: addCategory"><?php print _("Add Category"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="deleteCategoryDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Remove Cateogry"); ?></h3>
</div>
<div class="modal-body">
<p>
<?php print _("Confirm you want to remove:"); ?> <strong id="removeCategoryName">this category</strong>
</p>
</div>
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: removeCategory"><?php print _("Remove Category"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</body>
<!-- include js -->
<?php include 'modules/js.php'; ?>
<script type="text/javascript" src="js/viewModels/models.js?v=<?php print VERSION; ?>"></script>
<script type="text/javascript" src="js/viewModels/pagesModel.js?v=<?php print VERSION; ?>" defer="defer"></script>
</html>